문제

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.

도움이 되었습니까?

해결책

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,

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top