@Override public void onPause(boolean multitasking) { super.onPause(multitasking); gForeground = false; final NotificationManager notificationManager = (NotificationManager) cordova.getActivity().getSystemService(Context.NOTIFICATION_SERVICE); // notificationManager.cancelAll(); }
/** * Called when an activity you launched exits, giving you the requestCode you started it with, the * resultCode it returned, and any additional data from it. * * @param requestCode The request code originally supplied to startActivityForResult(), allowing * you to identify who this result came from. * @param resultCode The integer result code returned by the child activity through its * setResult(). * @param data An Intent, which can return result data to the caller (various data can be attached * to Intent "extras"). */ @Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { LOG.d(TAG, "Incoming Result"); super.onActivityResult(requestCode, resultCode, intent); Log.d(TAG, "Request code = " + requestCode); if (appView != null && requestCode == CordovaChromeClient.FILECHOOSER_RESULTCODE) { ValueCallback<Uri> mUploadMessage = this.appView.getWebChromeClient().getValueCallback(); Log.d(TAG, "did we get here?"); if (null == mUploadMessage) return; Uri result = intent == null || resultCode != Activity.RESULT_OK ? null : intent.getData(); Log.d(TAG, "result = " + result); mUploadMessage.onReceiveValue(result); mUploadMessage = null; } CordovaPlugin callback = this.activityResultCallback; if (callback == null && initCallbackClass != null) { // The application was restarted, but had defined an initial callback // before being shut down. this.activityResultCallback = appView.pluginManager.getPlugin(initCallbackClass); callback = this.activityResultCallback; } if (callback != null) { LOG.d(TAG, "We have a callback to send this result to"); callback.onActivityResult(requestCode, resultCode, intent); } }
@Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); CordovaPlugin callback = this.activityResultCallback; if (callback != null) { callback.onActivityResult(requestCode, resultCode, intent); } }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (currentContext != null) { currentContext.onActivityResult(requestCode, resultCode, data); } }
@Override public void onDestroy() { // locationApplication.stop(); releaseWakeLock(); cordova.getActivity().stopService(new Intent(cordova.getActivity(), LocationApplication.class)); super.onDestroy(); }
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); WindowManager manager = ((WindowManager) cordova.getActivity().getApplicationContext().getSystemService(Context.WINDOW_SERVICE)); WindowManager.LayoutParams localLayoutParams = new WindowManager.LayoutParams(); localLayoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR; localLayoutParams.gravity = Gravity.TOP; localLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | // this is to enable the notification to recieve touch events WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | // Draws over status bar WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN; localLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; localLayoutParams.height = (int) (30 * cordova.getActivity().getResources().getDisplayMetrics().scaledDensity); localLayoutParams.format = PixelFormat.TRANSPARENT; CustomViewGroup view = new CustomViewGroup(cordova.getActivity().getApplicationContext()); manager.addView(view, localLayoutParams); }
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); Log.i( TAG, "---------------- initialize" + "-" + JPushPlugin.openNotificationAlert + "-" + JPushPlugin.notificationAlert); shouldCacheMsg = false; // 如果同时缓存了打开事件openNotificationAlert 和 消息事件notificationAlert,只向UI 发 打开事件。 // 这样做是为了和iOS 统一 if (JPushPlugin.openNotificationAlert != null) { JPushPlugin.notificationAlert = null; JPushPlugin.transmitOpen( JPushPlugin.openNotificationAlert, JPushPlugin.openNotificationExtras); } if (JPushPlugin.notificationAlert != null) { JPushPlugin.transmitReceive(JPushPlugin.notificationAlert, JPushPlugin.notificationExtras); } // JPushInterface.init(cordova.getActivity().getApplicationContext()); }
@Override public void onResume(boolean multitasking) { super.onResume(multitasking); // Developers can observe how frequently users activate their app by logging an app activation // event. AppEventsLogger.activateApp(cordova.getActivity()); }
@Override public void onDestroy() { super.onDestroy(); gForeground = false; gECB = null; gWebView = null; }
public void initialize(final CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); // Restore preferences this.settings = this.cordova.getActivity().getSharedPreferences(SETTINGS_NAME, 0); this.lastSessionId = settings.getString("lastSessionId", ""); this.lastAppId = settings.getString("lastAppId", ""); }
public void onDestroy() { GCMRegistrar.onDestroy(getApplicationContext()); gWebView = null; gECB = null; gForeground = false; super.onDestroy(); }
@Override public void onDestroy() { cordova.getActivity().getApplicationContext().unregisterReceiver(mHeadsetReceiver); cordova.getActivity().getApplicationContext().unregisterReceiver(mNoisyAudioStreamReceiver); if (mMTSCRA != null) mMTSCRA.closeDevice(); super.onDestroy(); }
public void onDestroy() { super.onDestroy(); if (this.currentSession != null) { // this.currentSession.kill(new ChromecastSessionCallback() { // void onSuccess(Object object) { } // void onError(String reason) {} // }); } }
@Override public void onResume(boolean multitasking) { super.onResume(multitasking); Log.i("Backgroundgps", "~~ onResume"); // This does not get called when the app starts... // Log.i("Backgroundgps", "~~ register"); // Backgroundgps.getBus().register(this); }
@Override public void onPause(boolean multitasking) { super.onPause(multitasking); Log.i("Backgroundgps", "~~ onPause"); // This does get called when the app gets paused, so unregister from the bus Log.i("Backgroundgps", "~~ unregister"); Backgroundgps.getBus().unregister(this); }
@Override public void onNewIntent(Intent intent) { super.onNewIntent(intent); String offerData = null; if (intent != null && (offerData = intent.getStringExtra("com.vresorts.cordova.bgloc.NOTIFICATION_OFFER_DATA")) != null) { this.performNotificationClicked(offerData); } }
/** The final call you receive before your activity is destroyed. */ @Override public void onDestroy() { iBeaconManager.unBind(this); if (broadcastReceiver != null) { cordova.getActivity().unregisterReceiver(broadcastReceiver); broadcastReceiver = null; } super.onDestroy(); }
@Override public void onPause(boolean multitasking) { super.onPause(multitasking); gForeground = false; SharedPreferences prefs = getApplicationContext().getSharedPreferences(COM_ADOBE_PHONEGAP_PUSH, Context.MODE_PRIVATE); if (prefs.getBoolean(CLEAR_NOTIFICATIONS, true)) { clearAllNotifications(); } }
/** * Initializes the plugin. * * @param cordova The context of the main Activity * @param webView The CordovaWebView Cordova is running in */ @Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); beaconManager = new BeaconManager(this.cordova.getActivity().getApplicationContext()); currentRegion = new Region("regionId", REGION_ID, null, null); packageManager = this.cordova.getActivity().getPackageManager(); bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); }
@Override public void initialize(final CordovaInterface cordova, CordovaWebView webView) { safeToFireMessages = false; 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(); }
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); mContext = cordova.getActivity(); mContentResolver = cordova.getActivity().getContentResolver(); genIncomingCallBroadcastReceiver(); cordova .getActivity() .registerReceiver( mIncomingCallBroadcastReceiver, new IntentFilter(ACTION_PHONE_STATE_CHANGED)); }
@Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); Log.d( TAG, "activity result in plugin: requestCode(" + requestCode + "), resultCode(" + resultCode + ")"); callbackManager.onActivityResult(requestCode, resultCode, intent); }
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); context = cordova.getActivity(); locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (location != null) { onLocationChanged(location); } }
@Override public void initialize(final CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { final Activity activity = cordova.getActivity(); final Window window = activity.getWindow(); setTranslucentStatus(window); tintManager = new SystemBarTintManager(activity); } }
private void init(JSONArray args, CallbackContext callbackContext) { try { this.appId = args.getString(0); } catch (JSONException e) { throw new RuntimeException("Error getting appId", e); } super.cordova.setActivityResultCallback(this); Log.d(TAG, "Initialized with appId: " + this.appId); callbackContext.success(); }
@Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) { if (!ACTIONS.contains(action)) { Log.e(TAG, "Invalid action: " + action); return false; } Runnable task = getTask(action, args, callbackContext); super.cordova.getThreadPool().execute(task); return true; }
@Override public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { mMobileAccessibilityHelper = new KitKatMobileAccessibilityHelper(); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { mMobileAccessibilityHelper = new JellyBeanMobileAccessibilityHelper(); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { mMobileAccessibilityHelper = new IceCreamSandwichMobileAccessibilityHelper(); } else { mMobileAccessibilityHelper = new DonutMobileAccessibilityHelper(); } mMobileAccessibilityHelper.initialize(this); }
@Override public void onPause(boolean multitasking) { super.onPause(multitasking); gForeground = false; SharedPreferences prefs = getApplicationContext().getSharedPreferences(COM_ADOBE_PHONEGAP_PUSH, Context.MODE_PRIVATE); if (prefs.getBoolean(CLEAR_NOTIFICATIONS, true)) { final NotificationManager notificationManager = (NotificationManager) cordova.getActivity().getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.cancelAll(); } }
/** * Handle the user's action from the permissioning workflow. In this workflow a user may be asked * for access to his profile, email, offline access etc. * * <p>There are three situations we cover: * * <p>1. The user clicks sign in. We are not yet connected to the google services api. (common * case) * * <p>2. The user clicks sign in and we are already connected to the google services api. This * case is less common, and it's a bit confusing why we'd already be connected to the google * services api before the user clicks sign in. This case happens when the user sees multiple * pages in the permission workflow. The user will see multiple pages in the workflow when we * connect to the google services api (successfully), but on connection google tells us that we * should prompt the user for even more permissions that the first page of the workflow didn't ask * for via a UserRecoverableAuthException. For example, a user may first be prompted for basic * profile access. Then when we connect to the google services api it may suggest that we also * need to prompt the user for offline access. In this case we don't bother reconnecting to the * google services api again. Instead, we skip straight to resolving to the token. * * <p>3. The user clicks cancel. * * @param requestCode The request code originally supplied to startActivityForResult(), * @param resultCode The integer result code returned by the child activity through its * setResult(). * @param intent Information returned by the child activity */ @Override public void onActivityResult(int requestCode, final int resultCode, final Intent intent) { super.onActivityResult(requestCode, resultCode, intent); if (mGoogleApiClient == null) { buildGoogleApiClient(); } if (!mGoogleApiClient.isConnected() && resultCode == Activity.RESULT_OK) { mGoogleApiClient.connect(); } else if (resultCode == Activity.RESULT_OK) { this.resolveToken(email, result); } else { this.savedCallbackContext.error("user cancelled"); } }
public void onActivityResult(int requestCode, int resultCode, Intent intent) { Log.v(TAG, "onActivityResult: " + requestCode + " " + resultCode); super.onActivityResult(requestCode, resultCode, intent); if (ACTIVITY_CODE_PLAY_MEDIA == requestCode) { if (Activity.RESULT_OK == resultCode) { this.callbackContext.success(); } else if (Activity.RESULT_CANCELED == resultCode) { String errMsg = "Error"; if (intent != null && intent.hasExtra("message")) { errMsg = intent.getStringExtra("message"); } this.callbackContext.error(errMsg); } } }