Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add my Android app show in send list?

Tags:

android

send

I implement an app.
It can upload photos to my own server.
I want to let my app can list in send list when implement below code:

Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/jpeg");
share.putExtra(Intent.EXTRA_STREAM, Uri.parse(FilePath));
startActivity(Intent.createChooser(share, "Share Image"));

How can I do it?

like image 947
brian Avatar asked Nov 28 '12 02:11

brian


1 Answers

You need to add following in your manifest.

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

Your manifest should look something like follow.

<application android:name="MyApplication" android:allowBackup="true" android:icon="@drawable/ic_launcher"
android:label="@string/app_name" android:theme="@style/AppTheme">
    <activity android:name="com.example.arcasample.MainActivity" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.SEND"></action>
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="image/jpeg" />
        </intent-filter>
    </activity>
</application>
like image 142
Vipul Avatar answered Sep 28 '22 01:09

Vipul