List of usage examples for org.apache.cordova CordovaInterface getActivity
public abstract Activity getActivity();
From source file:br.com.denguezerocidadao.FileHelper.java
License:Apache License
/** * Returns the mime type of the data specified by the given URI string. * * @param uriString the URI string of the data * @return the mime type of the specified data */// www . jav a2s . c om public static String getMimeType(Uri uri, CordovaInterface cordova) { String mimeType = null; if ("content".equals(uri.getScheme())) { mimeType = cordova.getActivity().getContentResolver().getType(uri); } else { mimeType = getMimeTypeForExtension(uri.getPath()); } return mimeType; }
From source file:br.com.futuring.cordova.plugins.GooglePlayGame.java
License:Apache License
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); Activity cordovaActivity = cordova.getActivity(); googlePlayServicesReturnCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(cordovaActivity); if (googlePlayServicesReturnCode == ConnectionResult.SUCCESS) { gameHelper = new GameHelper(cordovaActivity, BaseGameActivity.CLIENT_GAMES); gameHelper.setup(this); } else {//from w ww . j a va2s. c om Log.w(LOGTAG, String.format("GooglePlayServices not available. Error: '" + GooglePlayServicesUtil.getErrorString(googlePlayServicesReturnCode) + "'. Error Code: " + googlePlayServicesReturnCode)); } cordova.setActivityResultCallback(this); }
From source file:br.com.hotforms.StatusBarManager.java
License:Apache License
/** * 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. *//*w w w. j a va 2 s. c o m*/ @Override public void initialize(final CordovaInterface cordova, CordovaWebView webView) { Log.v(TAG, "StatusBarManager: initialization"); super.initialize(cordova, webView); this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { Window window = cordova.getActivity().getWindow(); window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); } }); }
From source file:cn.edu.gdmec.t00385.lightsensor.LightSensorListener.java
License:Apache License
/** * 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. *///w w w. j ava2 s . c om public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); this.sensorManager = (SensorManager) cordova.getActivity().getSystemService(Context.SENSOR_SERVICE); }
From source file:com.adobe.phonegap.csdk.FileHelper.java
License:Apache License
/** * Returns the mime type of the data specified by the given URI string. * * @param uriString the URI string of the data * @return the mime type of the specified data */// ww w. ja va2s .co m public static String getMimeType(String uriString, CordovaInterface cordova) { String mimeType = null; Uri uri = Uri.parse(uriString); if (uriString.startsWith("content://")) { mimeType = cordova.getActivity().getContentResolver().getType(uri); } else { mimeType = getMimeTypeForExtension(uri.getPath()); } return mimeType; }
From source file:com.amazon.cordova.plugin.PushPlugin.java
License:Open Source License
/** * Sets the context of the Command. This can then be used to do things like get file paths associated with the * Activity.//from w w w. ja v a 2s. co m * * @param cordova * The context of the main Activity. * @param webView * The associated CordovaWebView. */ @Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); // Initialize only for Amazon devices 2nd Generation and later if (this.isAmazonDevice() && !isFirstGenKindleFireDevice()) { adm = new ADM(cordova.getActivity()); activity = (CordovaActivity) cordova.getActivity(); webview = this.webView; isForeground = true; ADMMessageHandler.saveConfigOptions(activity); } else { LOG.e(TAG, NON_AMAZON_DEVICE_ERROR); } }
From source file:com.android.plugins.GyroscopeListener.java
License:Open Source License
/** * 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 associated CordovaWebView. *//*from w ww . ja v a 2 s .co m*/ @Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); this.sensorManager = (SensorManager) cordova.getActivity().getSystemService(Context.SENSOR_SERVICE); }
From source file:com.appfeel.cordova.admob.AdMobAds.java
License:Open Source License
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); connectivity = Connectivity.GetInstance(cordova.getActivity(), this); connectivity.observeInternetConnection(); }
From source file:com.appfeel.cordova.connectivity.CPConnectivity.java
License:Open Source License
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); connectivity = Connectivity.GetInstance(cordova.getActivity(), this); // connectivityBR = new ComponentName(cordova.getActivity().getBaseContext(), ConnectivityBR.class); // pm = cordova.getActivity().getBaseContext().getPackageManager(); }
From source file:com.berriart.cordova.plugins.PlayGamesServices.java
License:Apache License
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); Activity cordovaActivity = cordova.getActivity(); googlePlayServicesReturnCode = GoogleApiAvailability.getInstance() .isGooglePlayServicesAvailable(cordovaActivity); if (googlePlayServicesReturnCode == ConnectionResult.SUCCESS) { gameHelper = new GameHelper(cordovaActivity, BaseGameActivity.CLIENT_GAMES); gameHelper.setup(this); } else {/* w w w .ja v a 2s . com*/ Log.w(LOGTAG, String.format("GooglePlayServices not available. Error: '" + GoogleApiAvailability.getInstance().getErrorString(googlePlayServicesReturnCode) + "'. Error Code: " + googlePlayServicesReturnCode)); } cordova.setActivityResultCallback(this); }