Receiving a send intent in Ionic via Capacitor

Asked
Active3 hr before
Viewed126 times

6 Answers

receiving
90%

Will the objection have any effect? ,I have an Ionic React project. This comes with Capacitor as bridge. I now want to receive "SEND" intents from other Apps to my Ionic app but I don't find anything suitable in Capacitor. The only solution I can think of is creating a custom plugin in Capacitor that will be triggered when I receive the intent in native code. Can anyone suggest a more direct solution?,Theoretical Computer Science

Pretag
 Pretag team - issue, fix, solve, resolve
88%

Accessing Called Data,Each plugin method receives an instance of com.getcapacitor.PluginCall containing all the information of the plugin method invocation from the client.,After generating a plugin, right click the Java plugin class in Android Studio and select the “Convert Java file to Kotlin file” option from the menu. Android Studio will walk you through configuring the project for Kotlin support. Once this is completed, right click the Java class again and re-select the conversion option to convert it to a Kotlin class.

Pretag
 Pretag team - issue, fix, solve, resolve
72%

This Plugin provides a general purpose shim layer for the Android intent mechanism, exposing various ways to handle sending and receiving intents.,If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.,For usage information please refer to the plugin's Github repo.

import {
   WebIntent
} from '@ionic-native/web-intent/ngx';

constructor(private webIntent: WebIntent) {}

   ...

   const options = {
      action: this.webIntent.ACTION_VIEW,
      url: 'path/to/file',
      type: 'application/vnd.android.package-archive'
   }

this.webIntent.startActivity(options).then(onSuccess, onError);
65%

Next, install the plugin:,Interface: IonicAuthOptions,If you have not already setup Ionic Enterprise in your app, follow the one-time setup steps.

npm install @ionic - enterprise / auth
Using React ? Also install : npm install @ionic - enterprise / auth - react
npx cap sync
load more v
75%

I get the same error with capacitor and I have 1.1.7 version. In startActivity instead of registerBroadcastReceiver.,If you want to test it yourself, with an already existing project, start here: https://capacitor.ionicframework.com/docs/getting-started/with-ionic, Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

D / Cordova Intents Shim: Action: registerBroadcastReceiver
E / PluginManager: Uncaught exception from plugin
java.lang.ClassCastException: de.test.example.MainActivity cannot be cast to org.apache.cordova.CordovaActivity
at com.darryncampbell.cordova.plugin.intent.IntentShim.execute(IntentShim.java: 118)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java: 98)
at org.apache.cordova.PluginManager.exec(PluginManager.java: 132)
at com.getcapacitor.MessageHandler.callCordovaPluginMethod(MessageHandler.java: 73)
at com.getcapacitor.MessageHandler.postMessage(MessageHandler.java: 46)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java: 323)
at android.os.Looper.loop(Looper.java: 136)
at android.os.HandlerThread.run(HandlerThread.java: 61)
load more v
40%

To send push notifications to your users with Ionic and Capacitor you don’t need a specific service, but you need to configure a bunch of things upfront to make it work. ,If you did everything correctly before you should now see a push notification on your device!, How to Cache API Responses with Ionic & Capacitor

Pretag
 Pretag team - issue, fix, solve, resolve

Other "receiving-undefined" queries related to "Receiving a send intent in Ionic via Capacitor"