How to share a file in Android programmatically

前端 未结 4 1219
旧时难觅i
旧时难觅i 2020-12-28 19:28

I want to share a file(.pdf,.apk etc) using share Intent, I searched google but I find only the code for sharing Image

Intent sharingIntent = new Intent(Inte         


        
4条回答
  •  灰色年华
    2020-12-28 20:26

    For sdk 24 and up, if you need to get the Uri of a file outside your app storage you have this error.

    android.os.FileUriExposedException: file:///storage/emulated/0/MyApp/Camera_20180105_172234.jpg exposed beyond app through ClipData.Item.getUri()
    

    to fix this : exposed beyond app through ClipData.Item.getUri

提交回复
热议问题