Closed RizwanArifHanfi closed 4 years ago
Hi, I do not know what could be causing that I'm afraid - I get a bit confused what the team did when they created the WebIntent plugin. You can call my plugin directly with:
(<any>window).plugins.intentShim.startActivity(options).then(onSuccess, onError);
which may avoid any conflicts with WebIntent
I tried your suggestion:
(<any>window).plugins.intentShim.startActivity(options).then(onSuccess, onError);
But unfortunately, it says (<any>window).plugins
undefined
Always getting this error when running in android studio:
Task :capacitor-cordova-android-plugins:compileDebugJavaWithJavac Note: /home/pc-rizwan/ionic/capacitor/app/android/capacitor-cordova-android-plugins/src/main/java/com/darryncampbell/plugin/intent/IntentShim.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.
Task :capacitor-android:generateDebugRFile
Task :capacitor-android:compileDebugJavaWithJavac Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details.
After trying different ways, managed to work with your suggestion:
(<any>window).plugins.intentShim.startActivity(options).then(onSuccess, onError);
used in my code as:
const options = {
action: (<any>window).plugins.intentShim.ACTION_VIEW,
url: 'path'
};
(<any>window).plugins.intentShim.startActivity(options).then(
(onSuccess) => {
console.log('Intent success: ', onSuccess);
alert('Intent success: ' + onSuccess);
}, (onError) => {
console.log('Intent failed: ', onError);
alert('Intent failed: ' + onError);
});
I got following error:
Wrong type for parameter "successCallback" of IntentShim.startActivity: Expected Function, but got Undefined.
Where i'm doing wrong?
Hi, I do not know what could be causing that I'm afraid - I get a bit confused what the team did when they created the WebIntent plugin. You can call my plugin directly with:
(<any>window).plugins.intentShim.startActivity(options).then(onSuccess, onError);
which may avoid any conflicts with WebIntent
Still gives error
After trying different ways, managed to work with your suggestion:
(<any>window).plugins.intentShim.startActivity(options).then(onSuccess, onError);
used in my code as:
const options = { action: (<any>window).plugins.intentShim.ACTION_VIEW, url: 'path' }; (<any>window).plugins.intentShim.startActivity(options).then( (onSuccess) => { console.log('Intent success: ', onSuccess); alert('Intent success: ' + onSuccess); }, (onError) => { console.log('Intent failed: ', onError); alert('Intent failed: ' + onError); });
I got following error:
Wrong type for parameter "successCallback" of IntentShim.startActivity: Expected Function, but got Undefined.
Where i'm doing wrong?
You are calling .then() but startActivity(...) does not return a promise. There is similar code for sending a broadcast at https://github.com/ZebraDevs/DataWedge-Ionic-Demo/blob/master/src/providers/barcode/barcode.ts#L92
Now working!
Thanks for support @darryncampbell :+1:
HI @darryncampbell
I'm integrating your plugin to invoke web intent to make Intent call to startActivity to choose UPI enabled app through chooser in my ionic-capacitor app
Code I'm calling below method to invoke web intent.
My IONIC environment
After Compilation When i compile to run on my device i'm getting following error: com/darryncampbell/plugin/intent/IntentShim.java uses or overrides a deprecated API and this.webIntent.startActivity(options).then(onSuccess, onError); always give error.
Also tried patching with
cordova-plugin-androidx-adapter
, but no luck.Run Log
Please suggest what I can do to make it wotking.