List of usage examples for org.apache.cordova CordovaInterface getThreadPool
public ExecutorService getThreadPool();
From source file:com.ingeneo.cordova.plugins.ibeacon.GPIBeacon.java
License:Open Source License
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); activity = cordova.getActivity();/*from w ww . j av a2s . co m*/ final GPIBeacon that = this; this.gForeground = true; this.lastNigh = new Time(); this.lastNigh.setToNow(); this.lastFar = new Time(); this.lastFar.setToNow(); this.firstNearFar = true; beaconsData = new HashMap<String, JSONObject>(); cordova.getThreadPool().execute(new Runnable() { @Override public void run() { iBeaconManager = IBeaconManager.getInstanceForApplication(activity); iBeaconManager.bind(that); } }); }
From source file:cordova.plugin.networking.bluetooth.NetworkingBluetooth.java
License:Apache License
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); this.mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (this.mBluetoothAdapter != null) { this.mPreviousScanMode = this.mBluetoothAdapter.getScanMode(); }/*from w w w . j a v a2 s . c o m*/ cordova.getThreadPool().execute(new Runnable() { public void run() { writeLoop(); } }); }
From source file:me.gpelaez.cordova.plugins.ibeacon.GPIBeacon.java
License:Open Source License
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); activity = cordova.getActivity();/*from w w w . j a va2 s . co m*/ final GPIBeacon that = this; this.gForeground = true; this.lastNigh = new Time(); this.lastNigh.setToNow(); this.lastFar = new Time(); this.lastFar.setToNow(); this.firstNearFar = true; beaconsData = new Hashtable<String, JSONObject>(); cordova.getThreadPool().execute(new Runnable() { @Override public void run() { iBeaconManager = IBeaconManager.getInstanceForApplication(activity); iBeaconManager.bind(that); } }); }
From source file:net.yoik.cordova.plugins.ibeacon.YoikIBeacon.java
License:Open Source License
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); final Activity activity = cordova.getActivity(); final YoikIBeacon that = this; this.lastNigh = new Time(); this.lastNigh.setToNow(); this.lastFar = new Time(); this.lastFar.setToNow(); this.firstNearFar = true; cordova.getThreadPool().execute(new Runnable() { @Override/*from www . ja v a 2s .c om*/ public void run() { iBeaconManager = IBeaconManager.getInstanceForApplication(activity); iBeaconManager.bind(that); } }); }
From source file:org.chromium.ChromeGcm.java
License:Open Source License
@Override public void initialize(final CordovaInterface cordova, CordovaWebView webView) { safeToFireMessages = false;//from ww w. j av a 2 s . c om super.initialize(cordova, webView); ChromeGcm.webView = webView; executorService = cordova.getThreadPool(); if (cordova.getActivity().getIntent().hasExtra(PAYLOAD_LABEL)) { cordova.getActivity().moveTaskToBack(true); } context = cordova.getActivity().getApplicationContext(); }
From source file:org.chromium.ChromeNotifications.java
License:Open Source License
@Override public void initialize(final CordovaInterface cordova, CordovaWebView webView) { safeToFireEvents = false;/*from w w w . j a v a2 s .c o m*/ super.initialize(cordova, webView); notificationManager = (NotificationManager) cordova.getActivity() .getSystemService(Context.NOTIFICATION_SERVICE); if (ChromeNotifications.webView == null && NOTIFICATION_CLOSED_ACTION .equals(cordova.getActivity().getIntent().getStringExtra(NOTIFICATION_ACTION_LABEL))) { // In this case we are starting up the activity again in response to a notification being closed. We do not // want to interrupt the user by bringing the activity to the foreground in this case so move it to the // background. cordova.getActivity().moveTaskToBack(true); } ChromeNotifications.webView = webView; executorService = cordova.getThreadPool(); }
From source file:org.chromium.ChromePushMessaging.java
License:Open Source License
@Override public void initialize(final CordovaInterface cordova, CordovaWebView webView) { safeToFireMessages = false;//from w ww. j av a 2 s .c o m super.initialize(cordova, webView); ChromePushMessaging.webView = webView; executorService = cordova.getThreadPool(); if (cordova.getActivity().getIntent().hasExtra(PAYLOAD_LABEL)) { cordova.getActivity().moveTaskToBack(true); } }
From source file:plugin.google.maps.GoogleMaps.java
@SuppressLint("NewApi") @Override/* w w w.ja va 2 s . c om*/ public void initialize(final CordovaInterface cordova, final CordovaWebView webView) { super.initialize(cordova, webView); activity = cordova.getActivity(); density = Resources.getSystem().getDisplayMetrics().density; final View view = webView.getView(); root = (ViewGroup) view.getParent(); // Is this release build version? boolean isRelease = false; try { PackageManager manager = activity.getPackageManager(); ApplicationInfo appInfo = manager.getApplicationInfo(activity.getPackageName(), 0); isRelease = !((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) == ApplicationInfo.FLAG_DEBUGGABLE); } catch (Exception e) { } //Log.i("CordovaLog", "This app uses phonegap-googlemaps-plugin version " + PLUGIN_VERSION); if (!isRelease) { cordova.getThreadPool().execute(new Runnable() { @Override public void run() { try { /* JSONArray params = new JSONArray(); params.put("get"); params.put("http://plugins.cordova.io/api/plugin.google.maps"); HttpRequest httpReq = new HttpRequest(); httpReq.initialize(cordova, null); httpReq.execute("execute", params, new CallbackContext("version_check", webView) { @Override public void sendPluginResult(PluginResult pluginResult) { if (pluginResult.getStatus() == PluginResult.Status.OK.ordinal()) { try { JSONObject result = new JSONObject(pluginResult.getStrMessage()); JSONObject distTags = result.getJSONObject("dist-tags"); String latestVersion = distTags.getString("latest"); if (latestVersion.equals(PLUGIN_VERSION) == false) { Log.i("CordovaLog", "phonegap-googlemaps-plugin version " + latestVersion + " is available."); } } catch (JSONException e) {} } } }); */ } catch (Exception e) { } } }); } cordova.getActivity().runOnUiThread(new Runnable() { @SuppressLint("NewApi") public void run() { /* try { Method method = webView.getClass().getMethod("getSettings"); WebSettings settings = (WebSettings)method.invoke(null); settings.setRenderPriority(RenderPriority.HIGH); settings.setCacheMode(WebSettings.LOAD_NO_CACHE); } catch (Exception e) { e.printStackTrace(); } */ if (Build.VERSION.SDK_INT >= 21) { view.setLayerType(View.LAYER_TYPE_HARDWARE, null); } root.setBackgroundColor(Color.WHITE); if (VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); } if (VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { Log.d(TAG, "Google Maps Plugin reloads the browser to change the background color as transparent."); view.setBackgroundColor(0); try { Method method = webView.getClass().getMethod("reload"); method.invoke(webView); } catch (Exception e) { e.printStackTrace(); } } } }); }