1、进行动态授权,
2、AndroidX之前需要在manifest注册
<!-- FileProvider配置访问路径,适配7.0及其以上 -->
(1)
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
(2)
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
androidX改成
(1)
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />