darryncampbell-cordova-plugin-intent
darryncampbell-cordova-plugin-intent copied to clipboard
IONIC 5 with Capacitor facing to launch another app and get callback using startActivityForResult
I am using Ionic Angular with capacitor, we need to launch an external application which is our dependent application (Nativescript). With the ID of the app I need to launch and get callback once get image data. How to achieve this using Intent? Getting error block log in console ` const options = { action: this.webIntent.ACTION_GET_CONTENT, package: 'de.myapp.eco' /*App package id in store installed in device */ }
this.webIntent.startActivityForResult(options).then((onSuccess) => {
console.log('onSuccess',onSuccess)
}).catch((error: any) => console.log('error',error));`
Can you please guide me out to achieve the result?
@darryncampbell @mcelotti @mattdsteele
To invoke another application directly you can specify the component, please see https://github.com/darryncampbell/plugin-intent-api-exerciser/blob/master/www/js/index.js#L233 for an example
Thank you @darryncampbell , It works.
It opens the external application, But it closes of the source application. Any Idea how to make it without closing source application?
it should just be invoking start activity, are you saying the calling app is being finish()'d?
Yes @darryncampbell for example 'A' app calls 'B' app, In this cased 'B' is opened but 'A' is closed. What I want is that 'A' app should be opened after B is closed. Hope you got it? How to achieve this using startActivityForResult?
How to achieve this using startActivityForResult?
For StartActivityForResult example see https://github.com/darryncampbell/plugin-intent-api-exerciser/blob/master/www/js/index.js#L190. To return data from StartActivityForResult see https://github.com/darryncampbell/plugin-intent-api-exerciser/blob/master/www/js/index.js#L347 (this is test code to return from being invoked by https://github.com/darryncampbell/plugin-intent-api-exerciser-helper/blob/master/app/src/main/java/com/darryncampbell/pluginintentapiexerciserhelper/MainActivity.java#L24)