Java Code Examples for org.apache.cordova.CordovaInterface#getActivity()
The following examples show how to use
org.apache.cordova.CordovaInterface#getActivity() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AndroidWearPlugin.java From cordova-androidwear with Apache License 2.0 | 6 votes |
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); Log.d(TAG, "initialize"); Activity context = cordova.getActivity(); serviceIntent = new Intent(context, WearProviderService.class); Log.d(TAG, "Attempting to start service"); context.startService(serviceIntent); Log.d(TAG, "Attempting to bind to service"); context.bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE); }
Example 2
Source File: Notification.java From reader with MIT License | 5 votes |
@SuppressLint("NewApi") private AlertDialog.Builder createDialog(CordovaInterface cordova) { int currentapiVersion = android.os.Build.VERSION.SDK_INT; if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) { return new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT); } else { return new AlertDialog.Builder(cordova.getActivity()); } }
Example 3
Source File: GooglePlayGamesPlugin.java From cordova-google-play-games-services with MIT License | 5 votes |
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); mainActivity = cordova.getActivity(); getApiClient(); }
Example 4
Source File: Notification.java From phonegapbootcampsite with MIT License | 5 votes |
/** * Show the progress dialog. * * @param title Title of the dialog * @param message The message of the dialog */ public synchronized void progressStart(final String title, final String message) { if (this.progressDialog != null) { this.progressDialog.dismiss(); this.progressDialog = null; } final Notification notification = this; final CordovaInterface cordova = this.cordova; Runnable runnable = new Runnable() { public void run() { notification.progressDialog = new ProgressDialog(cordova.getActivity()); notification.progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); notification.progressDialog.setTitle(title); notification.progressDialog.setMessage(message); notification.progressDialog.setCancelable(true); notification.progressDialog.setMax(100); notification.progressDialog.setProgress(0); notification.progressDialog.setOnCancelListener( new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { notification.progressDialog = null; } }); notification.progressDialog.show(); } }; this.cordova.getActivity().runOnUiThread(runnable); }
Example 5
Source File: Notification.java From phonegapbootcampsite with MIT License | 5 votes |
/** * Show the progress dialog. * * @param title Title of the dialog * @param message The message of the dialog */ public synchronized void progressStart(final String title, final String message) { if (this.progressDialog != null) { this.progressDialog.dismiss(); this.progressDialog = null; } final Notification notification = this; final CordovaInterface cordova = this.cordova; Runnable runnable = new Runnable() { public void run() { notification.progressDialog = new ProgressDialog(cordova.getActivity()); notification.progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); notification.progressDialog.setTitle(title); notification.progressDialog.setMessage(message); notification.progressDialog.setCancelable(true); notification.progressDialog.setMax(100); notification.progressDialog.setProgress(0); notification.progressDialog.setOnCancelListener( new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { notification.progressDialog = null; } }); notification.progressDialog.show(); } }; this.cordova.getActivity().runOnUiThread(runnable); }
Example 6
Source File: Notification.java From reader with MIT License | 5 votes |
@SuppressLint("NewApi") private AlertDialog.Builder createDialog(CordovaInterface cordova) { int currentapiVersion = android.os.Build.VERSION.SDK_INT; if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) { return new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT); } else { return new AlertDialog.Builder(cordova.getActivity()); } }
Example 7
Source File: Notification.java From reader with MIT License | 5 votes |
@SuppressLint("NewApi") private AlertDialog.Builder createDialog(CordovaInterface cordova) { int currentapiVersion = android.os.Build.VERSION.SDK_INT; if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) { return new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT); } else { return new AlertDialog.Builder(cordova.getActivity()); } }
Example 8
Source File: Notification.java From reader with MIT License | 5 votes |
@SuppressLint("InlinedApi") private ProgressDialog createProgressDialog(CordovaInterface cordova) { int currentapiVersion = android.os.Build.VERSION.SDK_INT; if (currentapiVersion >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) { return new ProgressDialog(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT); } else { return new ProgressDialog(cordova.getActivity()); } }
Example 9
Source File: AdvancedGeolocation.java From cordova-plugin-advanced-geolocation with Apache License 2.0 | 5 votes |
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); _cordova = cordova; _cordovaActivity = cordova.getActivity(); _sharedPreferences = PreferenceManager.getDefaultSharedPreferences(_cordovaActivity); _permissionsController = new PermissionsController(_cordovaActivity, _cordova); _permissionsController.handleOnInitialize(); removeActionPreferences(); Log.d(TAG, "Initialized"); }
Example 10
Source File: FileUtils.java From L.TileLayer.Cordova with MIT License | 4 votes |
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); this.filesystems = new ArrayList<Filesystem>(); String tempRoot = null; String persistentRoot = null; Activity activity = cordova.getActivity(); String packageName = activity.getPackageName(); String location = activity.getIntent().getStringExtra("androidpersistentfilelocation"); if (location == null) { location = "compatibility"; } tempRoot = activity.getCacheDir().getAbsolutePath(); if ("internal".equalsIgnoreCase(location)) { persistentRoot = activity.getFilesDir().getAbsolutePath() + "/files/"; this.configured = true; } else if ("compatibility".equalsIgnoreCase(location)) { /* * Fall-back to compatibility mode -- this is the logic implemented in * earlier versions of this plugin, and should be maintained here so * that apps which were originally deployed with older versions of the * plugin can continue to provide access to files stored under those * versions. */ if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { persistentRoot = Environment.getExternalStorageDirectory().getAbsolutePath(); tempRoot = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/" + packageName + "/cache/"; } else { persistentRoot = "/data/data/" + packageName; } this.configured = true; } if (this.configured) { // Create the directories if they don't exist. new File(tempRoot).mkdirs(); new File(persistentRoot).mkdirs(); // Register initial filesystems // Note: The temporary and persistent filesystems need to be the first two // registered, so that they will match window.TEMPORARY and window.PERSISTENT, // per spec. this.registerFilesystem(new LocalFilesystem("temporary", cordova, tempRoot)); this.registerFilesystem(new LocalFilesystem("persistent", cordova, persistentRoot)); this.registerFilesystem(new ContentFilesystem(cordova, webView)); registerExtraFileSystems(getExtraFileSystemsPreference(activity), getAvailableFileSystems(activity)); // Initialize static plugin reference for deprecated getEntry method if (filePlugin == null) { FileUtils.filePlugin = this; } } else { Log.e(LOG_TAG, "File plugin configuration error: Please set AndroidPersistentFileLocation in config.xml to one of \"internal\" (for new applications) or \"compatibility\" (for compatibility with previous versions)"); activity.finish(); } }
Example 11
Source File: FileUtils.java From reader with MIT License | 4 votes |
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); this.filesystems = new ArrayList<Filesystem>(); String tempRoot = null; String persistentRoot = null; Activity activity = cordova.getActivity(); String packageName = activity.getPackageName(); String location = activity.getIntent().getStringExtra("androidpersistentfilelocation"); if (location == null) { location = "compatibility"; } tempRoot = activity.getCacheDir().getAbsolutePath(); if ("internal".equalsIgnoreCase(location)) { persistentRoot = activity.getFilesDir().getAbsolutePath() + "/files/"; this.configured = true; } else if ("compatibility".equalsIgnoreCase(location)) { /* * Fall-back to compatibility mode -- this is the logic implemented in * earlier versions of this plugin, and should be maintained here so * that apps which were originally deployed with older versions of the * plugin can continue to provide access to files stored under those * versions. */ if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { persistentRoot = Environment.getExternalStorageDirectory().getAbsolutePath(); tempRoot = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/" + packageName + "/cache/"; } else { persistentRoot = "/data/data/" + packageName; } this.configured = true; } if (this.configured) { // Create the directories if they don't exist. new File(tempRoot).mkdirs(); new File(persistentRoot).mkdirs(); // Register initial filesystems // Note: The temporary and persistent filesystems need to be the first two // registered, so that they will match window.TEMPORARY and window.PERSISTENT, // per spec. this.registerFilesystem(new LocalFilesystem("temporary", cordova, tempRoot)); this.registerFilesystem(new LocalFilesystem("persistent", cordova, persistentRoot)); this.registerFilesystem(new ContentFilesystem(cordova, webView)); registerExtraFileSystems(getExtraFileSystemsPreference(activity), getAvailableFileSystems(activity)); // Initialize static plugin reference for deprecated getEntry method if (filePlugin == null) { FileUtils.filePlugin = this; } } else { Log.e(LOG_TAG, "File plugin configuration error: Please set AndroidPersistentFileLocation in config.xml to one of \"internal\" (for new applications) or \"compatibility\" (for compatibility with previous versions)"); activity.finish(); } }
Example 12
Source File: FileUtils.java From reader with MIT License | 4 votes |
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); this.filesystems = new ArrayList<Filesystem>(); String tempRoot = null; String persistentRoot = null; Activity activity = cordova.getActivity(); String packageName = activity.getPackageName(); String location = activity.getIntent().getStringExtra("androidpersistentfilelocation"); if (location == null) { location = "compatibility"; } tempRoot = activity.getCacheDir().getAbsolutePath(); if ("internal".equalsIgnoreCase(location)) { persistentRoot = activity.getFilesDir().getAbsolutePath() + "/files/"; this.configured = true; } else if ("compatibility".equalsIgnoreCase(location)) { /* * Fall-back to compatibility mode -- this is the logic implemented in * earlier versions of this plugin, and should be maintained here so * that apps which were originally deployed with older versions of the * plugin can continue to provide access to files stored under those * versions. */ if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { persistentRoot = Environment.getExternalStorageDirectory().getAbsolutePath(); tempRoot = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/" + packageName + "/cache/"; } else { persistentRoot = "/data/data/" + packageName; } this.configured = true; } if (this.configured) { // Create the directories if they don't exist. new File(tempRoot).mkdirs(); new File(persistentRoot).mkdirs(); // Register initial filesystems // Note: The temporary and persistent filesystems need to be the first two // registered, so that they will match window.TEMPORARY and window.PERSISTENT, // per spec. this.registerFilesystem(new LocalFilesystem("temporary", cordova, tempRoot)); this.registerFilesystem(new LocalFilesystem("persistent", cordova, persistentRoot)); this.registerFilesystem(new ContentFilesystem(cordova, webView)); registerExtraFileSystems(getExtraFileSystemsPreference(activity), getAvailableFileSystems(activity)); // Initialize static plugin reference for deprecated getEntry method if (filePlugin == null) { FileUtils.filePlugin = this; } } else { Log.e(LOG_TAG, "File plugin configuration error: Please set AndroidPersistentFileLocation in config.xml to one of \"internal\" (for new applications) or \"compatibility\" (for compatibility with previous versions)"); activity.finish(); } }
Example 13
Source File: FileUtils.java From reacteu-app with MIT License | 4 votes |
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); this.filesystems = new ArrayList<Filesystem>(); this.pendingRequests = new PendingRequests(); String tempRoot = null; String persistentRoot = null; Activity activity = cordova.getActivity(); String packageName = activity.getPackageName(); String location = preferences.getString("androidpersistentfilelocation", "internal"); tempRoot = activity.getCacheDir().getAbsolutePath(); if ("internal".equalsIgnoreCase(location)) { persistentRoot = activity.getFilesDir().getAbsolutePath() + "/files/"; this.configured = true; } else if ("compatibility".equalsIgnoreCase(location)) { /* * Fall-back to compatibility mode -- this is the logic implemented in * earlier versions of this plugin, and should be maintained here so * that apps which were originally deployed with older versions of the * plugin can continue to provide access to files stored under those * versions. */ if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { persistentRoot = Environment.getExternalStorageDirectory().getAbsolutePath(); tempRoot = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/" + packageName + "/cache/"; } else { persistentRoot = "/data/data/" + packageName; } this.configured = true; } if (this.configured) { // Create the directories if they don't exist. File tmpRootFile = new File(tempRoot); File persistentRootFile = new File(persistentRoot); tmpRootFile.mkdirs(); persistentRootFile.mkdirs(); // Register initial filesystems // Note: The temporary and persistent filesystems need to be the first two // registered, so that they will match window.TEMPORARY and window.PERSISTENT, // per spec. this.registerFilesystem(new LocalFilesystem("temporary", webView.getContext(), webView.getResourceApi(), tmpRootFile)); this.registerFilesystem(new LocalFilesystem("persistent", webView.getContext(), webView.getResourceApi(), persistentRootFile)); this.registerFilesystem(new ContentFilesystem(webView.getContext(), webView.getResourceApi())); this.registerFilesystem(new AssetFilesystem(webView.getContext().getAssets(), webView.getResourceApi())); registerExtraFileSystems(getExtraFileSystemsPreference(activity), getAvailableFileSystems(activity)); // Initialize static plugin reference for deprecated getEntry method if (filePlugin == null) { FileUtils.filePlugin = this; } } else { Log.e(LOG_TAG, "File plugin configuration error: Please set AndroidPersistentFileLocation in config.xml to one of \"internal\" (for new applications) or \"compatibility\" (for compatibility with previous versions)"); activity.finish(); } }
Example 14
Source File: Fingerprint.java From cordova-plugin-fingerprint-aio with MIT License | 4 votes |
public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); Log.v(TAG, "Init Fingerprint"); mPromptInfoBuilder = new PromptInfo.Builder(cordova.getActivity()); }
Example 15
Source File: FileUtils.java From reader with MIT License | 4 votes |
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); this.filesystems = new ArrayList<Filesystem>(); String tempRoot = null; String persistentRoot = null; Activity activity = cordova.getActivity(); String packageName = activity.getPackageName(); String location = activity.getIntent().getStringExtra("androidpersistentfilelocation"); if (location == null) { location = "compatibility"; } tempRoot = activity.getCacheDir().getAbsolutePath(); if ("internal".equalsIgnoreCase(location)) { persistentRoot = activity.getFilesDir().getAbsolutePath() + "/files/"; this.configured = true; } else if ("compatibility".equalsIgnoreCase(location)) { /* * Fall-back to compatibility mode -- this is the logic implemented in * earlier versions of this plugin, and should be maintained here so * that apps which were originally deployed with older versions of the * plugin can continue to provide access to files stored under those * versions. */ if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { persistentRoot = Environment.getExternalStorageDirectory().getAbsolutePath(); tempRoot = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/" + packageName + "/cache/"; } else { persistentRoot = "/data/data/" + packageName; } this.configured = true; } if (this.configured) { // Create the directories if they don't exist. new File(tempRoot).mkdirs(); new File(persistentRoot).mkdirs(); // Register initial filesystems // Note: The temporary and persistent filesystems need to be the first two // registered, so that they will match window.TEMPORARY and window.PERSISTENT, // per spec. this.registerFilesystem(new LocalFilesystem("temporary", cordova, tempRoot)); this.registerFilesystem(new LocalFilesystem("persistent", cordova, persistentRoot)); this.registerFilesystem(new ContentFilesystem(cordova, webView)); registerExtraFileSystems(getExtraFileSystemsPreference(activity), getAvailableFileSystems(activity)); // Initialize static plugin reference for deprecated getEntry method if (filePlugin == null) { FileUtils.filePlugin = this; } } else { Log.e(LOG_TAG, "File plugin configuration error: Please set AndroidPersistentFileLocation in config.xml to one of \"internal\" (for new applications) or \"compatibility\" (for compatibility with previous versions)"); activity.finish(); } }
Example 16
Source File: FileUtils.java From keemob with MIT License | 4 votes |
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); this.filesystems = new ArrayList<Filesystem>(); this.pendingRequests = new PendingRequests(); String tempRoot = null; String persistentRoot = null; Activity activity = cordova.getActivity(); String packageName = activity.getPackageName(); String location = preferences.getString("androidpersistentfilelocation", "internal"); tempRoot = activity.getCacheDir().getAbsolutePath(); if ("internal".equalsIgnoreCase(location)) { persistentRoot = activity.getFilesDir().getAbsolutePath() + "/files/"; this.configured = true; } else if ("compatibility".equalsIgnoreCase(location)) { /* * Fall-back to compatibility mode -- this is the logic implemented in * earlier versions of this plugin, and should be maintained here so * that apps which were originally deployed with older versions of the * plugin can continue to provide access to files stored under those * versions. */ if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { persistentRoot = Environment.getExternalStorageDirectory().getAbsolutePath(); tempRoot = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/" + packageName + "/cache/"; } else { persistentRoot = "/data/data/" + packageName; } this.configured = true; } if (this.configured) { // Create the directories if they don't exist. File tmpRootFile = new File(tempRoot); File persistentRootFile = new File(persistentRoot); tmpRootFile.mkdirs(); persistentRootFile.mkdirs(); // Register initial filesystems // Note: The temporary and persistent filesystems need to be the first two // registered, so that they will match window.TEMPORARY and window.PERSISTENT, // per spec. this.registerFilesystem(new LocalFilesystem("temporary", webView.getContext(), webView.getResourceApi(), tmpRootFile)); this.registerFilesystem(new LocalFilesystem("persistent", webView.getContext(), webView.getResourceApi(), persistentRootFile)); this.registerFilesystem(new ContentFilesystem(webView.getContext(), webView.getResourceApi())); this.registerFilesystem(new AssetFilesystem(webView.getContext().getAssets(), webView.getResourceApi())); registerExtraFileSystems(getExtraFileSystemsPreference(activity), getAvailableFileSystems(activity)); // Initialize static plugin reference for deprecated getEntry method if (filePlugin == null) { FileUtils.filePlugin = this; } } else { LOG.e(LOG_TAG, "File plugin configuration error: Please set AndroidPersistentFileLocation in config.xml to one of \"internal\" (for new applications) or \"compatibility\" (for compatibility with previous versions)"); activity.finish(); } }
Example 17
Source File: DialogGPS.java From cordova-dialog-gps with MIT License | 4 votes |
/** * Method that create a new Dialog. * * @param cordova CordovaInterface to append the dialog created. * the dialog is forced to display with the theme light default **/ @SuppressLint( "NewApi" ) private AlertDialog.Builder newDialog(CordovaInterface cordova,final String title,final String message, final String description) { final Context context = cordova.getActivity().getApplicationContext(); final String packageName = context.getPackageName(); AlertDialog.Builder builder; int dpi = context.getResources().getDisplayMetrics().densityDpi; int currentapiVersion = android.os.Build.VERSION.SDK_INT; if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) { builder = new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT); } else { builder = new AlertDialog.Builder(cordova.getActivity()); } builder.setMessage(message); builder.setTitle(title); LinearLayout _layout = new LinearLayout(context); LinearLayout.LayoutParams _layout_params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT); _layout.setLayoutParams(_layout_params); _layout.setPadding(0, dpToPixels(20,dpi),dpToPixels(24,dpi),0); _layout.setOrientation(LinearLayout.HORIZONTAL); ImageView _icon = new ImageView(context); _icon.setImageResource(cordova.getActivity().getResources().getIdentifier("ic_location","drawable",packageName)); TextView _description = new TextView(context); _icon.setLayoutParams(new LinearLayout.LayoutParams(dpToPixels(72,dpi),dpToPixels(72,dpi))); _description.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,dpToPixels(72,dpi))); _icon.setContentDescription("Location Icon"); _icon.setPadding(dpToPixels(24,dpi),0,dpToPixels(24,dpi),dpToPixels(24,dpi)); _icon.setColorFilter(Color.argb(139,0,0,0)); _description.setTextSize(16); _description.setText(description); _description.setTextColor(Color.argb(139,0,0,0)); _layout.addView(_icon); _layout.addView(_description); builder.setView(_layout); return builder; }
Example 18
Source File: ChromeCustomTabPlugin.java From cordova-plugin-safariviewcontroller with MIT License | 4 votes |
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); mCustomTabPluginHelper = new CustomTabServiceHelper(cordova.getActivity()); }
Example 19
Source File: FileUtils.java From keemob with MIT License | 4 votes |
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); this.filesystems = new ArrayList<Filesystem>(); this.pendingRequests = new PendingRequests(); String tempRoot = null; String persistentRoot = null; Activity activity = cordova.getActivity(); String packageName = activity.getPackageName(); String location = preferences.getString("androidpersistentfilelocation", "internal"); tempRoot = activity.getCacheDir().getAbsolutePath(); if ("internal".equalsIgnoreCase(location)) { persistentRoot = activity.getFilesDir().getAbsolutePath() + "/files/"; this.configured = true; } else if ("compatibility".equalsIgnoreCase(location)) { /* * Fall-back to compatibility mode -- this is the logic implemented in * earlier versions of this plugin, and should be maintained here so * that apps which were originally deployed with older versions of the * plugin can continue to provide access to files stored under those * versions. */ if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { persistentRoot = Environment.getExternalStorageDirectory().getAbsolutePath(); tempRoot = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/" + packageName + "/cache/"; } else { persistentRoot = "/data/data/" + packageName; } this.configured = true; } if (this.configured) { // Create the directories if they don't exist. File tmpRootFile = new File(tempRoot); File persistentRootFile = new File(persistentRoot); tmpRootFile.mkdirs(); persistentRootFile.mkdirs(); // Register initial filesystems // Note: The temporary and persistent filesystems need to be the first two // registered, so that they will match window.TEMPORARY and window.PERSISTENT, // per spec. this.registerFilesystem(new LocalFilesystem("temporary", webView.getContext(), webView.getResourceApi(), tmpRootFile)); this.registerFilesystem(new LocalFilesystem("persistent", webView.getContext(), webView.getResourceApi(), persistentRootFile)); this.registerFilesystem(new ContentFilesystem(webView.getContext(), webView.getResourceApi())); this.registerFilesystem(new AssetFilesystem(webView.getContext().getAssets(), webView.getResourceApi())); registerExtraFileSystems(getExtraFileSystemsPreference(activity), getAvailableFileSystems(activity)); // Initialize static plugin reference for deprecated getEntry method if (filePlugin == null) { FileUtils.filePlugin = this; } } else { LOG.e(LOG_TAG, "File plugin configuration error: Please set AndroidPersistentFileLocation in config.xml to one of \"internal\" (for new applications) or \"compatibility\" (for compatibility with previous versions)"); activity.finish(); } }
Example 20
Source File: GoogleFit.java From cordova-plugin-googlefit with MIT License | 3 votes |
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); actContext = cordova.getActivity(); appContext = actContext.getApplicationContext(); initDataTypes(); cordova.setActivityResultCallback(this); buildFitnessClient(); }