/** * Sets the context of the Command. This can then be used to do things like get file paths * associated with the Activity. * * @param cordova The context of the main Activity. * @param webView The CordovaWebView Cordova is running in. */ public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); this.sockMan = (ConnectivityManager) cordova.getActivity().getSystemService(Context.CONNECTIVITY_SERVICE); this.connectionCallbackContext = null; // We need to listen to connectivity events to update navigator.connection IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); if (this.receiver == null) { this.receiver = new BroadcastReceiver() { @SuppressWarnings("deprecation") @Override public void onReceive(Context context, Intent intent) { // (The null check is for the ARM Emulator, please use Intel Emulator for better // results) if (NetworkManager.this.webView != null) updateConnectionInfo( (NetworkInfo) intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO)); } }; cordova.getActivity().registerReceiver(this.receiver, intentFilter); this.registered = true; } }
public ExecutorService getThreadPool() { return cordova.getThreadPool(); }
public Object onMessage(String id, Object data) { return cordova.onMessage(id, data); }
public Activity getActivity() { return cordova.getActivity(); }
public void setActivityResultCallback(CordovaPlugin plugin) { cordova.setActivityResultCallback(plugin); }
public void startActivityForResult(CordovaPlugin command, Intent intent, int requestCode) { cordova.startActivityForResult(command, intent, requestCode); }