Share something to a phonegap app

S1TJK


To appear in this list you have to modify the AndroidManifest.xml file and add the following lines under your activity :

<intent-filter>
<action android:name=”android.intent.action.SEND” />
<category android:name=”android.intent.category.DEFAULT” />
<data android:mimeType=”text/plain” />
</intent-filter>
This will make your app appear in the list. Now I think you may probably also want to know how to handle this in your code. When another application is going to share some text with you, it’s going to start your application with an Android “Intent”. To be able to use Intents, you need a PhoneGap plugin. I think WebIntent might suit you. This would be the code :

// deviceready is PhoneGap’s init event
document.addEventListener(‘deviceready’, function () {
window.plugins.webintent.getExtra(WebIntent.EXTRA\_TEXT, function (url) {
// url is the value of EXTRA_TEXT
}, function() {
// There was no extra supplied.
});
});
More info on WebIntent here : http://smus.com/android-phonegap-plugins/

Note : I don’t think you’ll be able to do this with PhoneGap Build though … you can only use supported plugins, and can’t change the AndroidManifest.xml file that much. You’ll probably have to go the Cordova route and build everything on your machine.

more info 

http://stackoverflow.com/questions/16908224/share-something-to-a-phonegap-app