How I make my app to be shown on available apps th

2019-07-30 07:28发布

I'm building a app with sounds to be shared via WhatsApp, it's almost done, however is missing a single thing, that I already tried everything, but nothing seems to work. I wanna that when the user click on share button of own whatsApp (the one that is a clip) my app be listed on list of possible apps to do that action, this way:

enter image description here

I already tried use a intent filter on a activity like

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

and too

<intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <data android:mimeType="audio/*" />
            </intent-filter>

however my app wasn't shown, I already saw that is possible with other apps, I'm just doing something wrong. How I can do to make my app be listed? Anyone knows? Really Thx.

Note - the image is just a example, not a real one 'cause I can't print the screen of a real device, then I found this one on internet :(

EDIT 1 I tried this way too, but did not work

<activity
        android:name=".activities.HomeActivity"
        android:exported="true">
        <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.PICK" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="audio/*" />
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.GET_CONTENT" />
        <category android:name="android.intent.category.OPENABLE" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="audio/*" />
    </intent-filter>
</activity>

1条回答
可以哭但决不认输i
2楼-- · 2019-07-30 08:12
<intent-filter>
            <action android:name="android.intent.action.SEND" />
            <data android:mimeType="audio/*" />
        </intent-filter>

//and too

<intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <data android:mimeType="audio/*" />
        </intent-filter>

Replace With below code

//this is to get text from other app

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

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

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

For more idea here is an official document form android : https://developer.android.com/training/sharing/receive.html

查看更多
登录 后发表回答