Make Ionic app appear in "Share" list and receive data Make Ionic app appear in "Share" list and receive data ios ios

Make Ionic app appear in "Share" list and receive data


After some detailed analysis, this is what I could conclude:

In Android, you could just get your application added in the share list using cordova-plugin-intent as described here. You can also achieve this by adding intent filter in the activity as described here

In iOS, this is bit tricky as there are no straight forward plugins or readymade solution available to achieve this. But the best possible link i could get related to adding app in iOS share menu is getting listed in share menu The link includes apple documentation to do this and also some tweaking in Info.plist to acheive this.

This is the best possible answer I could think of. Hope it helps. Cheers.


For running the plugin https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent,try:

  • Install the plugin with --save to make sure the plugin is added to your config.xml

    ionic plugin add https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent --save
  • Since this plugin is not imported in ionic-native, you need to identify the global object. This will be declared in the plugin folder->plugin.xml. Here the object is intentShim.

       <js-module name="IntentShim" src="www/IntentShim.js">      <clobbers target="intentShim" />  </js-module>
  • In your code declare global object as:

    declare var intentShim:any;

    And in your function,

    private registerBroadcastReceiver(){  intentShim.registerBroadcastReceiver({      filterActions: [          'com.darryncampbell.cordova.plugin.broadcastIntent.ACTION'          ]      },      function(intent) {          //  Broadcast received          console.log('Received Intent: ' + JSON.stringify(intent.extras));      }  );}


try

window.intentShim.registerBroadcastReceiver

or call function inside

document.addEventListener('deviceready', function(){    registerBroadcastReceiver() }, false);


matomo