Gmail 5.0 app fails with “Permission denied for the attachment” when it receives ACTION_SEND intent

后端 未结 9 1204
感动是毒
感动是毒 2020-11-27 18:35

My app creates mails with attachments, and uses an intent with Intent.ACTION_SEND to launch a mail app.

It works with all the mail apps I tested with, e

9条回答
  •  眼角桃花
    2020-11-27 19:13

    You should implement a FileProvider, which can create Uris for your app's internal files. Other apps are granted permission to read these Uris. Then, simply instead of calling Uri.fromFile(attachment), you instantiate your FileProvider and use:

    fileProvider.getUriForFile(attachment);
    

提交回复
热议问题