open_file
open_file copied to clipboard
Extra permission
Here we have some default permissions https://github.com/crazecoder/open_file/blob/master/android/src/main/AndroidManifest.xml#L5-L6
- How can I remove them?
- Why we have
REQUEST_INSTALL_PACKAGES
? - I am always using getApplicationDocumentsDirectory so I think
READ_EXTERNAL_STORAGE
is redundant , right?
For ease of use, the required permissions are written in the plugin. If you don't need them, you can remove them like this
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="xxxxx">
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"
tools:node="remove"/>
</manifest>
These permissions should not be included by default and should be moved to the readme page. "Don't unnecessarily request storage-related permissions for devices that run Android 10 or higher" https://developer.android.com/training/data-storage/shared/media
Same goes for "requestLegacyExternalStorage"
Starting May 5th, you must let us know why your app requires broad storage access with content
We've detected that your app contains the requestLegacyExternalStorage flag in the manifest file of 1 or more of your app bundles or APKs.
@micsan13br It has been removed in 3.2.0
@crazecoder I'm using 3.2.1 and I still get this warning in Play Console now:
I think because it is still referenced in code in OpenFilePlugin.java
:
@RequiresApi(api = Build.VERSION_CODES.M)
private void openApkFile() {
if (!canInstallApk()) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startInstallPermissionSettingActivity();
} else {
ActivityCompat.requestPermissions(activity,
new String[]{Manifest.permission.REQUEST_INSTALL_PACKAGES}, REQUEST_CODE);
}
} else {
startActivity();
}
}
For ease of use, the required permissions are written in the plugin. If you don't need them, you can remove them like this
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="xxxxx"> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" tools:node="remove"/> </manifest>
This doesn't work for me - I have this in my manifest, and now I'm blocked from updating my app because the permission is still there: