Android: adding an app to “set picture as” list

后端 未结 2 1728
时光取名叫无心
时光取名叫无心 2021-01-06 12:08

I\'m trying to add my app to \"set as\" list, that shown in gallery when I choose an image. If the user open an image in the gallery, there is a button for set as

相关标签:
2条回答
  • 2021-01-06 12:38

    The intent-filter to add out own app to the list in Gallery and Photos app for "use as" or "set picture as" is ATTACH_DATA.

    <intent-filter>
                <action android:name="android.intent.action.ATTACH_DATA"/>
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="image/*" />
    </intent-filter>
    
    0 讨论(0)
  • 2021-01-06 12:42

    Now i've understand: You have to register your Activity to handle Images input from other apps. Insert this in your Manifest:

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

    More infos on Develop>Training>Receiving Simple Data from Other Apps

    0 讨论(0)
提交回复
热议问题