diff --git a/README.md b/README.md
index f01d5e0..c057b70 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,12 @@
# WebIntents plugin for Phonegap #
-By Boris Smus
+By Mahomedalid Pacheco (fork of Boris Smus)
## Adding the Plugin to your project ##
1. To install the plugin, move webintent.js to your project's www folder and include a reference to it in your html files.
-2. Create the path "com/borismus/webintent" within your project's src/ folder and move the java file into it.
+2. Create the path "com/lizardsc/webintent" within your project's src/ folder and move the java file into it.
3. Add the plugin to your `res/xml/config.xml` file:
-``
+``
## Using the plugin ##
The plugin creates the object `window.plugins.webintent` with five methods:
diff --git a/plugin.xml b/plugin.xml
index a126a27..f1a24ed 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -3,7 +3,7 @@
WebIntent
Web Intent Plugin
@@ -18,11 +18,11 @@
-
+
-
+
diff --git a/src/android/WebIntent.java b/src/android/WebIntent.java
index c1b2d87..3b84383 100644
--- a/src/android/WebIntent.java
+++ b/src/android/WebIntent.java
@@ -1,4 +1,4 @@
-package com.borismus.webintent;
+package com.lizardsc.webintent;
import java.util.HashMap;
import java.util.Map;
@@ -24,7 +24,7 @@
* (after setting up correct intent filters for PhoneGap applications), Android
* intents can be handled by PhoneGap web applications.
*
- * @author boris@borismus.com
+ * @author boris@lizardsc.com
*
*/
public class WebIntent extends Plugin {
@@ -51,22 +51,31 @@ public PluginResult execute(String action, JSONArray args, String callbackId) {
// Parse the arguments
JSONObject obj = args.getJSONObject(0);
- String type = obj.has("type") ? obj.getString("type") : null;
- Uri uri = obj.has("url") ? Uri.parse(obj.getString("url")) : null;
- JSONObject extras = obj.has("extras") ? obj.getJSONObject("extras") : null;
- Map extrasMap = new HashMap();
+
+ if(obj.has("package") {
+ String package = obj.has("package") ? obj.getString("package");
+ Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("package");
+ ((DroidGap)this.cordova.getActivity()).startActivity(LaunchIntent);
- // Populate the extras if any exist
- if (extras != null) {
- JSONArray extraNames = extras.names();
- for (int i = 0; i < extraNames.length(); i++) {
- String key = extraNames.getString(i);
- String value = extras.getString(key);
- extrasMap.put(key, value);
+ } else {
+ String type = obj.has("type") ? obj.getString("type") : null;
+ Uri uri = obj.has("url") ? Uri.parse(obj.getString("url")) : null;
+ JSONObject extras = obj.has("extras") ? obj.getJSONObject("extras") : null;
+ Map extrasMap = new HashMap();
+
+ // Populate the extras if any exist
+ if (extras != null) {
+ JSONArray extraNames = extras.names();
+ for (int i = 0; i < extraNames.length(); i++) {
+ String key = extraNames.getString(i);
+ String value = extras.getString(key);
+ extrasMap.put(key, value);
+ }
}
+
+ startActivity(obj.getString("action"), uri, type, extrasMap);
}
-
- startActivity(obj.getString("action"), uri, type, extrasMap);
+
return new PluginResult(PluginResult.Status.OK);
} else if (action.equals("hasExtra")) {