您的应用程序正在使用内容提供程序以及openfile的不安全实现:应用程序被Playstore拒绝

时间:2019-07-19 12:51:32

标签: android android-contentprovider

我的应用被拒绝了,原因是您的应用使用的内容提供程序具有不安全的openfile实现。

@Override
    public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
        File privateFile = new File(uri.getPath());
        ParcelFileDescriptor desc = ParcelFileDescriptor.open(privateFile, ParcelFileDescriptor.MODE_READ_ONLY);

        return desc;
    }

 <provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="${applicationId}.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true"
            tools:replace="android:authorities">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_provider_paths"
                tools:replace="android:resource" />
 </provider>


<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <external-path name="external_files" path="."/>
    <external-path name="image_path" path="file:///sdcard/temporary_file.jpg"/>
</paths>

<!--<external-path name="image_path" path="file:///storage/emulated/0/Infogainify/Default"/>-->

0 个答案:

没有答案
相关问题