Reputation: 21
When we try to change the target sdk version 29 to 30. We got the below error.
This should work as is when targeting API 28 (now forbidden by Google Play)
This should work when targeting API 29 with the dev version of the plugin (which has the android:requestLegacyExternalStorage="true"), alternatively you can use the edit-config to add this flag.
This won't work when targeting API 30, as API 30 ignores the android:requestLegacyExternalStorage attribute.
It's important to read the Android Notes before you target API 30. You may need to migrate your files to another folder to maintain access to them when targeting API 30 using the new APIs.
Is there any solution to resolve this. Thanks in advance !
Upvotes: 0
Views: 715
Reputation: 11
After two days spending we got one this solution for this API level 30 external storage issue in cordova.
I made a little modification in CordovaActivity.java in init() function.
protected void init() {
appView = makeWebView();
createViews();
if (!appView.isInitialized()) {
appView.init(cordovaInterface, pluginEntries, preferences);
}
/********** MODIFICATION SDK 30 **********/
WebView webView = (SystemWebView)(appView.getEngine().getView());
WebSettings webSettings = webView.getSettings();
webSettings.setAllowFileAccess(true);
/**********************************/
cordovaInterface.onCordovaInit(appView.getPluginManager());
// Wire the hardware volume controls to control media if desired.
String volumePref = preferences.getString("DefaultVolumeStream", "");
if ("media".equals(volumePref.toLowerCase(Locale.ENGLISH))) {
setVolumeControlStream(AudioManager.STREAM_MUSIC);
}
}
Upvotes: 1