1. 程式人生 > >Android7.0文件訪問權限

Android7.0文件訪問權限

provide utf load mission perm extern grant download nal

例子:下載apk然後安裝

<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.wj.autocoffeem.fileProvider"
android:exported="false"
android:grantUriPermissions="true" >

<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />

</provider>

//provider_paths

技術分享圖片

<?xml version="1.0" encoding="utf-8"?>
<resources>
<paths>
<!--360-->
<!--<root-path path="" name="camera_photos" />-->
<!--與`${RNFS.ExternalStorageDirectoryPath}/NewApp.apk`這個路勁匹配的-->

<files-path path="" name="camera_photos" />
<!--與`${RNFS.DocumentDirectoryPath}/NewApp.apk`這個路勁匹配的-->
</paths>
</resources>

下載路勁:const downloadDestPath = `${RNFS.DocumentDirectoryPath}/NewApp.apk`;


Android7.0文件訪問權限