Reputation: 437
I want to receive information shared from other applications.
For this I am trying to use The plugin WebIntent : https://github.com/phonegap/phonegap-plugins/tree/master/Android/WebIntent
Use Phonegap 2.5.0
In AndroidManifest.xml (To show my application in the section to share)
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
In index.html
document.addEventListener('deviceready', onDeviceready, true);
function onDeviceready() {
window.plugins.webintent.getUri(function(url) {
if(url !== "") {
// url is the url the intent was launched with
alert (url);
}
});
}
var url, the value returned is null.
Plugin src/com/borismus/webintent/WebIntent.java
in res/xml/config.xml
</plugins>
....
....
<plugin name="WebIntent" value="com.borismus.webintent.WebIntent" />
</plugins>
Thanks!!!
Upvotes: 3
Views: 1471
Reputation: 437
I can get the uri now! I'm using:
window.plugins.webintent.getExtra(window.plugins.webintent.EXTRA_TEXT, function (url) {
alert(url);
}, function() { //Fail
alert ("error");
});
Upvotes: 3