How to provide content for Intent.ACTION_GET_CONTENT

Viewed 7105

The web and stackoverflow contain several examples how to get a file from another Android app (e.g., to use it as email attachment) using an ACTION_GET_CONTENT intent. But what kind of class do I have to implement to create an application providing content for the ACTION_GET_CONTENT event such as I can choose this app (e.g., for selecting an email attachment).

Is a ContentProvider the right solution? And what do I have to add to my AndroidManifest.xml?

2 Answers

starting from api level 18 incoming intent can also have EXTRA_ALLOW_MULTIPLE set to true and in this case you can send back in result more than one file. To do so you need to set it as ClipData:

resultIntent.setClipData(clipData)
Related