title: Make Ionic app appear in "Share" list and receive data
body: <p>I am trying to get an Ionic app to appear in the &quot;Share&quot; list when a user clicks the share button for example for an image. <br /><br /></p>
  <p><a href="https://i.stack.imgur.com/J28Nm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/J28Nm.png" alt="Sharing example" /></a> <br /></p>
  <p>As far as I understand I have to add something like</p>
  <pre><code>&lt;intent-filter&gt; 
     &lt;action android:name=&quot;android.intent.action.SEND&quot; /&gt;
     &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;
     &lt;data android:mimeType=&quot;image/*&quot; /&gt;
  &lt;/intent-filter&gt;
  </code></pre>
  <p>to the <code>AndroidManifest.xml</code>. That I can do using the <a href="https://github.com/dpa99c/cordova-custom-config" rel="noreferrer">cordova-custom-config plugin</a>, I think. <br />
  I would then have to handle that intent somehow though and that is where it gets tricky for me. Seems like the only cordova plugin that is currently maintaned for intents is <a href="https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent" rel="noreferrer">this one</a>. I tried using it like this:</p>
  <pre><code>  initializeApp() {
      this.platform.ready().then(() =&gt; {
        // Okay, so the platform is ready and our plugins are available.
        // Here you can do any higher level native things you might need.
        this.statusBar.styleDefault();
        this.splashScreen.hide();
        this.registerBroadcastReceiver();
      });
    }
    private registerBroadcastReceiver(){
        window.plugins.intentShim.registerBroadcastReceiver({
            filterActions: [
                'com.darryncampbell.cordova.plugin.broadcastIntent.ACTION'
                ]
            },
            function(intent) {
                //  Broadcast received
                console.log('Received Intent: ' + JSON.stringify(intent.extras));
            }
        );
    }
  </code></pre>
  <p>But this way I am getting an error that window.plugins is undefined. <strong>I don't really know how I would integrate this with Ionic</strong>.</p>
  <p><strong>Also this only works for Android, I would like to have that work for iOS too.</strong>
  <a href="https://stackoverflow.com/questions/16908224/share-something-to-a-phonegap-app">This SO question</a> is related and mentions a way to do it for iOS, but it's about 4 years old (the linked iOS parts 5 years) and the project webintent specified for Android in the answer doesn't even exist anymore.</p>
  <p>Would be great if someone could help me out here.</p>
  <p><em><strong>Also related:</strong></em></p>
  <ul>
  <li><a href="https://stackoverflow.com/questions/41087273/cordova-receive-shared-data-from-other-app">Cordova receive shared data from other app</a> - Uses outdated plugin, <code>window.plugins</code>, Android specific.</li>
  <li><a href="https://stackoverflow.com/questions/32856046/sending-url-to-ionic-android-app-via-webintents-from-another-app/34444688#34444688">Sending url to ionic android app via webintents from another app</a> - Uses outdated plugin, <code>window.plugins</code>, Android specific.</li>
  </ul>
  <p><em><strong>Update</strong></em></p>
  <p><strong>All the answers are focusing on Android only, I was really hoping somebody could point me in the right direction for iOS as I would need it there even more...</strong></p>
  <h1>Final conclusion &amp; bounty</h1>
  <p><strong>Bounty</strong> <br />
  After long consideration I have concluded to give the bounty to @Ghandi. Although nobody could give a full answer, he was the only one trying to answer the whole question - including the iOS part. I wasn't expecting a full code solution, just a pointer in the right direction for both Android and iOS and that's what he came closest to of all answers. I know this is a very broad question and <strong>I'd like to thank everyone who took the time to answer and / or comment this question.</strong></p>
  <h3>For other's who are trying to accomplish the same thing, here is what I conclude of all my research and the answers here</h3>
  <p><strong>Android</strong>
  <br />
  As I describe already in my question above, you have to add those lines to the <code>AndroidManifest.xml</code>. Android will then make your app appear in the share list. The data that your app receives you'll have to handle via a so called <a href="https://developer.android.com/reference/android/content/Intent.html" rel="noreferrer">Intent</a>. To do so you can use <a href="https://ionicframework.com/docs/native/web-intent/" rel="noreferrer">Ionic Native - Web Intent</a>. As of 9.5.2017 this would not work yet as the Plugin Ionic Native is using does not exist anymore. I have however created an <a href="https://github.com/driftyco/ionic-native/issues/1517" rel="noreferrer">issue on Github</a> where I have been told that the next version of Ionic Native (I think 3.7.0), which should be released in the next two weeks, should fix this by using the <a href="https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent" rel="noreferrer">plugin</a> mentioned in my question above already. This resolves the issue of having to kinda play around the Ionic Framework yourself and simply being able to use Ionic Native.</p>
  <p><strong>iOS</strong>
  <br />
  In iOS it seems to be a bit more tricky and also there is less to be found of it around the web. It's best you follow the link that @Ghandi provides in his answer below.</p>