Question

I want to select image attachment through my application in Whatsapp.

In Whatsapp sending Attachment from Gallery page, the ShareIntentProvider would provide native Gallery app and Google's Photos to select image. How can I make my application support on it?

I know how to share image from my application to Whatsapp, but I don't know how to make Whatsapp allow my application to select image for attachment.

Était-ce utile?

La solution

In your AndroidManifest.xml for the Activity that you want to open (from whatsapp) add the following intent filters:

<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="image/*" />
    <data android:mimeType="video/*" />
</intent-filter>
<intent-filter>
    <action android:name="android.intent.action.PICK" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="image/*" />
    <data android:mimeType="video/*" />
</intent-filter>

Your applications should now display in the whatsapp gallery list,

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top