Reputation: 1448
I´m new to android development and I´m currently writing my first Capacitor Android app (with Quasar/Vue) and I want to the app to be able to receive files/images shared from other apps. So far I found out how to register my app as a share target (from here [1])
In Android Manifest I do:
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
android:name="org.cordova.MYAPP.app.MainActivity"
android:label="@string/title_activity_main"
android:theme="@style/AppTheme.NoActionBarLaunch"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
...
</activity>
So far so good. My app now shows up as a target in the share menu for image files. Touching the icon for my app in that share menu launches my app correctly.
But now I can´t figure out how to handle the incoming intent. The Android documentation [2] suggests to use the getIntent()
Java API but I don´t know how to translate that into Capacitor. The Capacitor documentation is pretty lightweight in that regard [3]
How can I receive incoming intent calls with Capacitor and handle the data in my Quasar/Vue app? Is that the right way to think about it?
Any pointers are appreciated! Thx
[1] https://developer.android.com/training/sharing/receive
[2] https://developer.android.com/training/sharing/receive#handling-content
[3] https://capacitor.ionicframework.com/docs/apis/share/
Upvotes: 4
Views: 2260
Reputation: 97
Just ran into this post now, I'm using this Cordova plugin: https://github.com/j3k0/cordova-plugin-openwith
if you managed to find a native ionic solution please share.
Upvotes: 2