Android Sharing Intent

会有一股神秘感。 提交于 2019-12-24 19:12:47

问题


Is there any way I can add/list my app with other apps like facebook, gmail, whatsapp and viber in sharing intent on android .? here is the sample image


回答1:


I don't how this would be done using Titanium, but in the conventional way (using Eclipse), this is how I do it in one of my apps:

CODE: In your manifest XML file, add the tag as shown below. This is to be done for an Activity that will handle data shared by the user. For example, if my Activity is named Composer, then the structure would be:

<activity
    android:name=".Composer"
    android:exported="true"
    android:windowSoftInputMode="stateHidden|adjustResize" >

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

        <category android:name="android.intent.category.DEFAULT" />

        <data android:mimeType="text/plain" />
        <data android:mimeType="image/jpeg" />
        <data android:mimeType="image/png" />
    </intent-filter>
</activity>

EXPLANATION OF THE CODE:

The key here are the data tags nested under the <intent-filter>. If I want my app listed when the user shares web links, the "text/plain" comes into play. When I want my app to handle Images shared from, say, the Gallery app, the "image/jpeg" and the "image/png" entries come into play (depending on the image file extension). As, however, indicated by the attached screenshot in the OP, if you only need to get your app listed in browsers when sharing web links, then the <data android:mimeType="text/plain" /> will do it for you.

Again, I do not know if the code above works as-is in Titanium. I have never used it nor have read up on it. You may have to tweak it a bit if there is a difference in how this is done when using Titanium.



来源:https://stackoverflow.com/questions/17511608/android-sharing-intent

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