Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

Making Sending a URL to my ionic app with web intent to work without crashing

$
0
0

Good evening, I've been struggling with getting web intents to work without the app crashing, I thought it would be straight forward but its not seeming to work.

I first attempted to use the plugin:

ionic plugin add https://github.com/Initsogar/cordova-webintent

and then removed the plugin and i also tried a more recently updated fork:

ionic plugin add https://github.com/fluentstream/cordova-webintent

In my app.js file I putting the following code:

.run(function($ionicPlatform, $rootScope, $ionicHistory, $state) { 
  $ionicPlatform.ready(function() {
    window.plugins.webintent.getExtra(window.plugins.webintent.EXTRA_TEXT,
    function(url) {
      incomingURL = url;
      //alert(incomingURL);
      console.log(incomingURL);
    }, function() {
      incomingURL = false;
      //alert("no url");
      console.log("no url");
    });
  });
})

I also tried:

.run(function($ionicPlatform, $rootScope, $ionicHistory, $state) { 
  $ionicPlatform.ready(function() {
    window.plugins.webintent.getUri(function(url) {
      if(url !== "") {
          alert(url);//url is the url the intent was launched with
      }
    }); 
  });
})

In the file config.xml I would put:

<plugin name="WebIntent" value="com.borismus.webintent.WebIntent"/>

In the AndroidManifest.xml I would manually put in:

<activity android:name="ShareActivity">
    <intent-filter>
        <action android:name="android.intent.action.SEND" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="text/plain" />
    </intent-filter>
</activity>

The app runs, but when I go to chrome and click the share button, and then choose my app, the app shuts down the following android message appears:

Unfortunately, MyAppName has stopped.

Can anybody suggest a plugin that can work with the ionic 1.1.0 and work...or am i forgetting something and doing something wrong.

Thank you!


Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>