美文网首页
jshare-react-native FileProvider

jshare-react-native FileProvider

作者: Bana | 来源:发表于2021-09-22 21:44 被阅读0次
  1. 更新到最新包
  2. 新建 wxapi/WeChatShareProvider
package com.dm_guide.wxapi;

import androidx.core.content.FileProvider;

public class WeChatShareProvider extends FileProvider {
}
  1. res/xml中添加jshare_file_provider_paths.xml文件
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <!--自定义配置分享文件目录访问权限-->
    <external-path name="sample-external-path" path="/"/>
    <files-path name="sample-files-path" path="/"/>
</paths>
  1. AndroidManifest.xml中添加
 <!--支持Android11以上系统,需要配置分享文件目录访问权限-->
        <provider
            android:name=".wxapi.WeChatShareProvider"
            android:authorities="${applicationId}.JSharefileprovider"
            android:exported="false"
            android:grantUriPermissions="true"
            tools:replace="android:authorities">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/jshare_file_provider_paths" />
        </provider>

相关文章

网友评论

      本文标题:jshare-react-native FileProvider

      本文链接:https://www.haomeiwen.com/subject/owwggltx.html