How to add PhoneGap apps at Androids sharing interface

大城市里の小女人 提交于 2020-01-20 06:51:45

问题


I am looking for an interface / PhoneGap plugin (or any idea), to pass images from the gallery directly to the phonegap app.

I am already using the cordova camera plugin in my app, however I am looking for a way without selecting images out of the app.

To make it a bit more clearly what I am looking for, please see the image below.

The app runs on Cordova 3.0.

Thanks a lot!

Regards, Peter


回答1:


The correct definition in the AndroidManifest.xml file is

<intent-filter>
     <action android:name="android.intent.action.SEND" />
     <category android:name="android.intent.category.DEFAULT" />
     <data android:mimeType="image/jpeg" />
</intent-filter>

Including the mimeType did the trick for me!




回答2:


It should work the same way for native as it does for phonegap/cordova.

Looking at a different post on stackoverflow, I believe you have to add the following intent to your activity in your Android manifest file.

<intent-filter>
    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

I got this info from How do I add my app to the Android 'share photo' option?




回答3:


@Jude Osborn and @Sivkumar , make sure you have added the intent filter to main activity ( tag with attribute android:name="MainActivity". Also see this plugin.

https://github.com/Initsogar/cordova-webintent

and you will have to take the edits from pull request (specially the one for EXTRA_STREAM, and the Plugin.xml ) because at the time I am writing this, the plugin authr has not taken the pull requests yet.



来源:https://stackoverflow.com/questions/19478769/how-to-add-phonegap-apps-at-androids-sharing-interface

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!