Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- android N 开始不允许以 `file://` 的方式通过 `Intent` 在两个 App 之间分享文件,取而代之的是通过 `FileProvider` 生成 `content://Uri`
- 这要求分享文件的两个 App 都需要支持这种新的 `schema`, 而事实并非如此。大量的第三方应用还并未支持这种新的文件共享方式。巨头应用微博就是其中之一。
- 为了更好的适配这些第三方应用,可以使用下面两种解决方式:
- 1. 更改 targetSdkVersion 到 24 以下
- 2. StrictMode 不设置 detectFileUriExposure
- ```
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
- StrictMode.setVmPolicy(builder.build());
- }
- ```
Add Comment
Please, Sign In to add comment