I'm trying to share an image using the "share with" function from another app to my Ionic 4 app. My app has to handle the image and use it. I've tried this solution but it is for Ionic 3. The plugins seems to be not mantained anymore. There has to be a solution for such a common task in Ionic 4.
I've tried the darryncampbell-cordova-plugin-intent without success. My code is
initializeApp() {
this.platform.ready().then(() => {
(<any>window).plugins.intentShim.registerBroadcastReceiver({
filterActions: [
'com.darryncampbell.cordova.plugin.broadcastIntent.ACTION'
],
filterCategories: [
'android.intent.category.DEFAULT',
],
}, (intent) => {
//your code to be executed after the broadcast is received..
console.log('Received Intent: ' + JSON.stringify(intent.extras));
});
//more code...
This code do nothing. Nothing at all. Iwas able to edit my config.xml to configure the manifest so my app shows up in the share with menus. This works well.
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>