简体   繁体   中英

How to launch my app from share menu of another app in android

I am trying to add my app in the "share" menu that comes when you try to attach an image in whats app or any other chat app. I just cant seem to figure this out. I want something like this:-

在此处输入图片说明

This is in what's app when i try to attach a picture, i click on "Gallery". It takes me to gallery and then in the share menu, I want my app to be present their..

在此处输入图片说明

I have tried putting these intent filters in my manifest but they don't seem to be working.

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

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


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

My app has pictures that can be attached in chat but i don't know why it doesn't show up in the menu. Please help

my manifest:-

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfragments"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/Theme.AppCompat" >
    <activity android:name=".TabActivity" />

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

            <data android:mimeType="image/*" />

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

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

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

            <data android:mimeType="image/*" />
        </intent-filter>


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

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

            <data android:mimeType="image/*" />
        </intent-filter>

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

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

heyy you can use Quick Menu for giving that menu option. Quick menu provide horizontal and vertical both option with image view. or u have to make your custom.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM