Go to file
Лампуша 1e40cae725 upload new version 0.1.0
added test scripts
2016-04-05 13:56:12 +03:00
src upload new version 0.1.0 2016-04-05 13:56:12 +03:00
test upload new version 0.1.0 2016-04-05 13:56:12 +03:00
www upload new version 0.1.0 2016-04-05 13:56:12 +03:00
.fetch.json Update .fetch.json 2015-01-20 12:47:16 +03:00
LICENSE.md Update LICENSE.md 2015-02-04 10:26:17 +03:00
MANUALLY_INSTALL.md upload new version 0.1.0 2016-04-05 13:56:12 +03:00
package.json upload new version 0.1.0 2016-04-05 13:56:12 +03:00
plugin.xml upload new version 0.1.0 2016-04-05 13:56:12 +03:00
README.md upload new version 0.1.0 2016-04-05 13:56:12 +03:00

cordova plugin startapp

Phonegap plugin for check or launch other application in android device.

=========================================== Install: cordova plugin add com.lampa.startapp

Install: cordova plugin add https://github.com/lampaa/com.lampa.startapp.git

Delete: cordova plugin rm com.lampa.startapp

Delete previos version: cordova plugin rm org.apache.cordova.startapp

=========================================== Manually installation for Android.

NEW! Script builder

use: ANDROID

Set appication parameters

var sApp = startApp.set({ /* params */
	"action":"ACTION_MAIN",
	"category":"CATEGORY_DEFAULT",
	"type":"text/css",
	"package":"com.lampa.startapp",
	"uri":"file://data/index.html",
	"intentstart":"startActivity",
	"flags":["FLAG_ACTIVITY_CLEAR_TOP","FLAG_ACTIVITY_CLEAR_TASK"],
	"component": ["com.app.name","com.app.name.Activity"]
}, { /* extras */
	"extraKey1":"extraValue1",
	"extraKey2":"extraValue2"
});

action these is a Intent action Intent setAction (optional, defaul null).

category these is a Intent method Intent addCategory (optional, defaul null).

type these is a Intent method Intent setType (optional, defaul null).

package (default null) these is a Intent method Intent setPackage (optional, defaul null).

uri (default null) these is a Intent data Uri [Intent Uri](http://developer.android.com/intl/ru/reference/android/content/Intent.html#Intent(java.lang.String, android.net.Uri)) (optional, defaul null).

flags (default null) these is a Intent method Intent setFlags (optional, defaul null).

component (default null) these is a Intent method Intent setComponent (optional, defaul null).

return startApp object:

sApp.start(function() { /* success */
	console.log("OK");
}, function(error) { /* fail */
	alert(error);
});

or

sApp.check(function(values) { /* success */
	console.log(values);
}, function(error) { /* fail */
	alert(error);
});

If success, values contains data: versionName, packageName, versionCode and applicationInfo.

Samples

Set application as only package name:

var sApp = startApp.set({
	"package":"com.application.name"
});

Set application as package and activity:

var sApp = startApp.set({
	"component": ["com.app.name","com.app.name.Activity"]
});

Set application as action, package, type and Uri:

var sApp = startApp.set({ /* params */
	"action":"ACTION_MAIN",
	"type":"text/css",
	"package":"com.lampa.startapp",
	"uri":"file://data/index.html"
});

Start application with extra fields

var sApp = startApp.set({ /* params */
	"component": ["com.app.name","com.app.name.Activity"]
}, { /* extras */
	"extraKey1":"extraValue1",
	"extraKey2":"extraValue2"
});

Example, call skype:

startApp.set({ /* params */
	"action": "ACTION_VIEW",
	"uri": "skype:+79109999999"
}).start();

Example, call phone:

startApp.set({ /* params */
	"action": "ACTION_CALL",
	"uri": "tel:+79109999999"
}).start();

Example, call browser:

startApp.set({ /* params */
	"action": "ACTION_VIEW",
	"uri": "https://github.com/lampaa"
}).start();

Example, call facebook:

startApp.set({ /* params */
	"action": "ACTION_VIEW",
	"uri": "fb://facewebmodal/f?href=https://www.facebook.com/GitHub"
}).start();

Example, call whatsapp:

startApp.set({ /* params */
	"action": "ACTION_SEND",
	"package": "com.whatsapp",
	"type": "text/plain"
}, {
	"android.intent.extra.TEXT":"Text..."
}).start();

Example, call whatsapp chat:

startApp.set({ /* params */
	"action": "ACTION_SEND",
	"package": "com.whatsapp",
	"type": "text/plain",
	"uri": "+79123456789"
}, {
	"android.intent.extra.TEXT":"Text...",
	"chat": true
}).start();

Example, call sms:

startApp.set({ /* params */
	"action": "ACTION_MAIN",
	"category": "CATEGORY_DEFAULT",
	"type": "vnd.android-dir/mms-sms"
}).start();

Example, play mp4 video:

startApp.set({ /* params */
	"action": "ACTION_VIEW",
	"uri": "http://domain.com/videofile.mp4",
	"type": "video/mp4"
}).start();

Example, open contacts book:

startApp.set({ /* params */
	"action": "ACTION_PICK",
	"uri": "ContactsContract.Contacts.CONTENT_URI",
	"type": "video/mp4",
	"intentstart":"startActivityForResult"
}).start();

Use iOS

Set iOS application

var sApp = startApp.set("twitter://");

return startApp object:

sApp.start(function() { /* success */
	console.log("OK");
}, function(error) { /* fail */
	alert(error);
});

or

sApp.check(function(values) { /* success */
	console.log(values);
}, function(error) { /* fail */
	alert(error);
});

=========================================== Tags:

Cordova start external application. Android open an external application. Phonegap start external application. Launching External Intents Works on Cordova. Android launch external activities. Android check app availability. Android launch application with parameters.