You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/09/16 13:40:45 UTC

[GitHub] [cordova-plugin-file] darnok333 commented on issue #426: Storage updates in Android 11

darnok333 commented on issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-920912498


   Hello,
   I just want to share a solution I found to my problem as it's related to this thread.
   
   
   **Problem with SDK 30 :**
   Out team used the path externalApplicationStorageDirectory to store some assets of the application, wich are downloaded the first time the user connect to the application.
   But we weren't able to access those files, and got an ACCESS_DENIED error.
   
   
   **Solution :**
   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);
       }
    }`
   
   
   you also need to add these import :
   
   import android.webkit.WebView;
   import android.webkit.WebSettings;
   import org.apache.cordova.engine.SystemWebView;
   
   
   Hope this can help some of you :)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org