com.lampa.startapp/README.md

140 lines
3.5 KiB
Markdown
Raw Normal View History

2014-12-18 17:08:44 +08:00
cordova-plugin-startapp # Upd 18.12.2014
2013-09-26 19:42:14 +08:00
===========================================================================
2015-01-19 23:02:17 +08:00
Phonegap 3.x.x plugin for check or launch other application in android device.
2013-09-26 19:42:14 +08:00
Install: ```cordova plugin add https://github.com/lampaa/com.lampa.startapp.git```
2013-09-26 19:45:08 +08:00
Delete: ```cordova plugin rm com.lampa.startapp```
2013-09-26 19:42:14 +08:00
2015-01-19 23:02:17 +08:00
Manually installation for Android:
```on progress...```
2014-12-18 17:08:27 +08:00
use: **ANDROID**
2014-03-23 18:53:40 +08:00
2015-01-19 23:02:17 +08:00
2014-12-18 17:08:27 +08:00
_Check application for installed_
2014-03-23 18:53:40 +08:00
```js
2014-12-18 17:08:27 +08:00
navigator.startApp.check("com.application.name", function(message) { /* success */
2014-03-23 18:53:40 +08:00
console.log(message); // => OK
},
function(error) { /* error */
2014-12-18 17:08:27 +08:00
console.log(error);
2014-03-23 18:53:40 +08:00
});
```
2014-12-18 17:08:27 +08:00
_Start application without parameters_
2014-03-23 18:53:40 +08:00
```js
navigator.startApp.start("com.application.name", function(message) { /* success */
2014-03-23 18:53:40 +08:00
console.log(message); // => OK
},
function(error) { /* error */
console.log(error);
2014-03-23 18:53:40 +08:00
});
```
2014-12-18 17:08:27 +08:00
_Start application with package name and activity_
2014-03-23 18:53:40 +08:00
2013-09-26 19:42:14 +08:00
```js
2014-12-18 17:08:27 +08:00
navigator.startApp.start([["com.app.name", "com.app.name.Activity"]], function(message) { /* success */
2014-03-23 18:53:40 +08:00
console.log(message); // => OK
},
function(error) { /* error */
2014-12-18 17:08:27 +08:00
console.log(error);
2014-03-23 18:53:40 +08:00
});
2014-07-11 02:50:39 +08:00
```
2014-12-18 17:13:37 +08:00
> **Important!** First value of first parameter of _start_ method can be either a string or an array. And the array must contain two parameters. Example:
>
> ["com.app.name", [....]] or [["com.app.name", "com.app.name.Activity"] [....]]
2014-12-18 17:12:31 +08:00
2014-12-18 17:08:27 +08:00
_Start application with only values_
2014-07-11 02:50:39 +08:00
2014-12-18 17:08:27 +08:00
```js
navigator.startApp.start([[...], ["set_param1", "set_param2",..., "set_paramN"]], function(message) { /* success */
console.log(message); // => OK
},
function(error) { /* error */
console.log(error);
});
```
_ANDROID: Start application with key:value parameters_
```js
navigator.startApp.start([[...], [{"key1":"value1"},{"key2":"value2"}, {...}, {"keyN":"valueN"}], function(message) { /* success */
console.log(message); // => OK
},
function(error) { /* error */
console.log(error);
});
```
Example, call application with activity and key:value param:
2014-07-11 02:50:39 +08:00
2014-12-18 17:08:27 +08:00
```js
navigator.startApp.start([["app.com.name", "app.com.name.Activity"], [{"product_id":"100"}], ...);
```
_ANDROID: Start application with action parameters_
```js
navigator.startApp.start([["action", "ACTION_NAME"], ["tel:+79109999999"], function(message) { /* success */
console.log(message); // => OK
},
function(error) { /* error */
console.log(error);
});
```
ACTION_NAME these is a Intent flag [Intent Flags](http://developer.android.com/reference/android/content/Intent.html) (MAIN, VIEW, CALL, etc..).
Example, call skype:
```js
navigator.startApp.start([["action", "VIEW"], ["skype:+79109999999"], ...);
```
Example, call phone:
```js
navigator.startApp.start([["action", "CALL"], ["tel:+79109999999"], ...);
```
Example, call browser:
```js
navigator.startApp.start([["action", "VIEW"], ["https://github.com/lampaa"], ...);
```
2015-01-19 17:30:29 +08:00
Example, call facebook:
```js
navigator.startApp.start([["action", "VIEW"], ["fb://facewebmodal/f?href=https://www.facebook.com/GitHub"], ...);
```
2014-07-11 02:50:39 +08:00
2014-12-18 17:08:27 +08:00
Use **iOS**
2015-01-19 22:43:03 +08:00
_Check iOS application for installed_
```js
navigator.startApp.check("twitter://", function(message) { /* success */
console.log(message); // => OK
},
function(error) { /* error */
console.log(error);
});
```
_Start iOS application_
2014-07-11 02:50:39 +08:00
```js
navigator.startApp.start("twitter://", function(message) { /* success */
console.log(message); // => OK
},
function(error) { /* error */
2015-01-19 22:43:03 +08:00
console.log(error);
2014-07-11 02:50:39 +08:00
});
```
2015-01-19 23:02:17 +08:00
===========================================
Tags:
Cordova start external application.
Android open an external application.
Phonegap start external application.
Launching External Intents Works on Cordova.
Android launch external activities.