Example usage for org.apache.cordova.file FileUtils registerFilesystem

List of usage examples for org.apache.cordova.file FileUtils registerFilesystem

Introduction

In this page you can find the example usage for org.apache.cordova.file FileUtils registerFilesystem.

Prototype

public void registerFilesystem(Filesystem fs) 

Source Link

Usage

From source file:org.chromium.SyncFileSystem.java

License:Open Source License

@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);
    String syncableRoot = cordova.getActivity().getFilesDir().getAbsolutePath() + "/syncfs/";
    new File(syncableRoot).mkdirs();

    PluginManager pm = null;/*from w ww . jav  a2  s.com*/
    try {
        Method gpm = webView.getClass().getMethod("getPluginManager");
        pm = (PluginManager) gpm.invoke(webView);
    } catch (Exception e) {
    }
    if (pm == null) {
        try {
            Field pmf = webView.getClass().getField("pluginManager");
            pm = (PluginManager) pmf.get(webView);
        } catch (Exception e) {
        }
    }
    FileUtils filePlugin = (FileUtils) pm.getPlugin("File");
    LocalFilesystem syncFs = new LocalFilesystem("syncable", cordova, syncableRoot);
    filePlugin.registerFilesystem(syncFs);
}