I’m developing an app that will be called by an android native app. I also have to call them. For doing this I found this plugin.
They will call my app (and expect m
Maybe it will help someone how I resolved it.
To open another android app I use the com.lampa.startapp. The code for doing it it's:
var sApp = startApp.set({
"package": "packageName" //The packageName of the app I want to open
}, {
//extras I want to add
"myParams" : "aaaaa"
});
sApp.start();
To work with intents (the ones that open my app) I use the cordova-plugin-intent with the following code:
//To get the intent and extras when the app it's open for the first time
window.plugins.intent.getCordovaIntent (function (intent) {
intenthandler(intent);
});
//To get the intent and extras if the app is running in the background
window.plugins.intent.setNewIntentHandler (function (intent) {
intenthandler(intent);
});
//To handle the params
var intenthandler = function (intent) {
if (intent && intent.extras && intent.extras.myParams) {
//Do something
}
};
That's all!