开发者

How to add app to "Share via" list for camera picture on Android

I am building an app that starts when a user takes a picture using their build-in Android camera, then taps the Share button, then chooses my app as the sharer, which is expecting an incoming path to the picture that was just taken, which it uses for processing.

Question: how do I add an option to the "Share via" list that points to my app? Right now there are options like Facebook, Email, Messages, Twitter, Picasa, and I want to add my app w/ an icon.

I'm stuck! And, Google'ing for this is not easy, as "android add to share via list camera" yields a lot of results. I'm building the app with AppInventor (AI), but, AI does not allow developers to edit the Share via list, so maybe this will have to be a separate mini app that just add开发者_如何转开发s to the list...? Hopefully not, because it'd be great to have just 1 app for users to download/install.


Functions like the "share via" in Android work with broadcast intents. The app creates this intent and the system reports all the activities that can execute that (twitter, fb...) You specify what an activity can do by means of intent filters.

In your case I searched for "android camera share intent" and found generally that the intent filter looks like this:

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

(not sure about the data section)

I don't know if camera app uses a specific content provider, anyway your app should be able to manage at least the URI scheme that app uses.


I wanted to Share text content and i add the below code in manifest and its works...

    <activity android:name=".SendMessage.SendMessageLeads"
        android:label="SMS Composer"
        android:icon="@drawable/sms_composer">

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

    </activity>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜