'Cordova net::ERR_ACCESS_DENIED after take photo on motorola e7 and android 10

Please can you help me, I have a problem with a cordova application, after taking a photo, it does not appear, and only this attachment message remains

attachment message

and the error appears on the console error console net::ERR_ACCES_DENIED

I did a little research, I found the cordova-diagnostic-plugin, but apparently even with the permission, the photos still don't show up cordova-plugin-diagnostic console

I'm working on a motorola e7 with android 10.

guys would anyone have any idea what's going on?

Best Regards! and thank you!



Solution 1:[1]

i was having the same error ERR_ACCES_DENIED when I updated my app to sdk 30 and trying to read a file.

I solved adding this lines to function init() in CodovaMainActivity.java

protected void init() {
        appView = makeWebView();
        createViews();
        if (!appView.isInitialized()) {
            appView.init(cordovaInterface, pluginEntries, preferences);
        }
        //Added Lines
        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);
        }
    }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dharman