android.os.ResultReceiver Java Examples
The following examples show how to use
android.os.ResultReceiver.
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: ActivityTransitionState.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
public void enterReady(Activity activity) { if (mEnterActivityOptions == null || mIsEnterTriggered) { return; } mIsEnterTriggered = true; mHasExited = false; ArrayList<String> sharedElementNames = mEnterActivityOptions.getSharedElementNames(); ResultReceiver resultReceiver = mEnterActivityOptions.getResultReceiver(); if (mEnterActivityOptions.isReturning()) { restoreExitedViews(); activity.getWindow().getDecorView().setVisibility(View.VISIBLE); } mEnterTransitionCoordinator = new EnterTransitionCoordinator(activity, resultReceiver, sharedElementNames, mEnterActivityOptions.isReturning(), mEnterActivityOptions.isCrossTask()); if (mEnterActivityOptions.isCrossTask()) { mExitingFrom = new ArrayList<>(mEnterActivityOptions.getSharedElementNames()); mExitingTo = new ArrayList<>(mEnterActivityOptions.getSharedElementNames()); } if (!mIsEnterPostponed) { startEnter(); } }
Example #2
Source File: PermissionUtils.java From flutter-incall-manager with ISC License | 6 votes |
public static void requestPermissions( final FlutterIncallManagerPlugin plugin, final String[] permissions, final Callback callback) { requestPermissions( plugin, permissions, new ResultReceiver(new Handler(Looper.getMainLooper())) { @Override protected void onReceiveResult( int resultCode, Bundle resultData) { callback.invoke( resultData.getStringArray(PERMISSIONS), resultData.getIntArray(GRANT_RESULTS)); } }); }
Example #3
Source File: Tethering.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** * Creates a proxy {@link ResultReceiver} which enables tethering if the provisioning result * is successful before firing back up to the wrapped receiver. * * @param type The type of tethering being enabled. * @param receiver A ResultReceiver which will be called back with an int resultCode. * @return The proxy receiver. */ private ResultReceiver getProxyReceiver(final int type, final ResultReceiver receiver) { ResultReceiver rr = new ResultReceiver(null) { @Override protected void onReceiveResult(int resultCode, Bundle resultData) { // If provisioning is successful, enable tethering, otherwise just send the error. if (resultCode == TETHER_ERROR_NO_ERROR) { enableTetheringInternal(type, true, receiver); } else { sendTetherResult(receiver, resultCode); } } }; // The following is necessary to avoid unmarshalling issues when sending the receiver // across processes. Parcel parcel = Parcel.obtain(); rr.writeToParcel(parcel,0); parcel.setDataPosition(0); ResultReceiver receiverForSending = ResultReceiver.CREATOR.createFromParcel(parcel); parcel.recycle(); return receiverForSending; }
Example #4
Source File: MediaSessionRecord.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
public boolean sendMediaButton(String packageName, int pid, int uid, boolean asSystemService, KeyEvent keyEvent, int sequenceId, ResultReceiver cb) { try { if (asSystemService) { mCb.onMediaButton(mContext.getPackageName(), Process.myPid(), Process.SYSTEM_UID, createMediaButtonIntent(keyEvent), sequenceId, cb); } else { mCb.onMediaButton(packageName, pid, uid, createMediaButtonIntent(keyEvent), sequenceId, cb); } return true; } catch (RemoteException e) { Slog.e(TAG, "Remote failure in sendMediaRequest.", e); } return false; }
Example #5
Source File: GoldLeaf.java From ns-usbloader-mobile with GNU General Public License v3.0 | 6 votes |
GoldLeaf(ResultReceiver resultReceiver, Context context, UsbDevice usbDevice, UsbManager usbManager, ArrayList<NSPElement> nspElements) throws Exception { super(resultReceiver, context, usbDevice, usbManager); this.nspElements = nspElements; String fileName; InputStream fileInputStream; fileInputStream = context.getContentResolver().openInputStream(nspElements.get(0).getUri()); fileName = nspElements.get(0).getFilename(); pfsElement = new PFSProvider(fileInputStream, fileName); if (! pfsElement.init()) throw new Exception("GL File provided have incorrect structure and won't be uploaded."); }
Example #6
Source File: UsbTransfer.java From ns-usbloader-mobile with GNU General Public License v3.0 | 6 votes |
UsbTransfer(ResultReceiver resultReceiver, Context context, UsbDevice usbDevice, UsbManager usbManager) throws Exception{ super(resultReceiver, context); if (usbManager == null) { finish(); return; } usbInterface = usbDevice.getInterface(0); epIn = usbInterface.getEndpoint(0); // For bulk read epOut = usbInterface.getEndpoint(1); // For bulk write deviceConnection = usbManager.openDevice(usbDevice); if ( ! deviceConnection.claimInterface(usbInterface, false)) { issueDescription = "USB: failed to claim interface"; throw new Exception("USB: failed to claim interface"); } }
Example #7
Source File: BluetoothAdapter.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** * Request the record of {@link BluetoothActivityEnergyInfo} object that * has the activity and energy info. This can be used to ascertain what * the controller has been up to, since the last sample. * * A null value for the activity info object may be sent if the bluetooth service is * unreachable or the device does not support reporting such information. * * @param result The callback to which to send the activity info. * @hide */ public void requestControllerActivityEnergyInfo(ResultReceiver result) { try { mServiceLock.readLock().lock(); if (mService != null) { mService.requestActivityInfo(result); result = null; } } catch (RemoteException e) { Log.e(TAG, "getControllerActivityEnergyInfoCallback: " + e); } finally { mServiceLock.readLock().unlock(); if (result != null) { // Only send an immediate result if we failed. result.send(0, null); } } }
Example #8
Source File: InputMethodService.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @MainThread @Override public void hideSoftInput(int flags, ResultReceiver resultReceiver) { if (DEBUG) Log.v(TAG, "hideSoftInput()"); boolean wasVis = isInputViewShown(); mShowInputFlags = 0; mShowInputRequested = false; doHideWindow(); clearInsetOfPreviousIme(); if (resultReceiver != null) { resultReceiver.send(wasVis != isInputViewShown() ? InputMethodManager.RESULT_HIDDEN : (wasVis ? InputMethodManager.RESULT_UNCHANGED_SHOWN : InputMethodManager.RESULT_UNCHANGED_HIDDEN), null); } }
Example #9
Source File: DfuBaseService.java From microbit with Apache License 2.0 | 6 votes |
@Override protected void onHandleIntent(final Intent intent) { int phase = intent.getIntExtra(INTENT_REQUESTED_PHASE, 0) & 0x03; resultReceiver = (ResultReceiver) intent.getParcelableExtra(INTENT_RESULT_RECEIVER); delayForInitDeviceFirmware = intent.getLongExtra(EXTRA_WAIT_FOR_INIT_DEVICE_FIRMWARE, 0); int rc = 0; logi("DFUBaseService onHandleIntent phase = " + phase); mServicePhase = 0; if ((phase & FLASHING_WITH_PAIR_CODE) != 0) { mServicePhase = FLASHING_WITH_PAIR_CODE; rc = flashingWithPairCode(intent); } if (resultReceiver != null) { rc <<= 8; resultReceiver.send(rc | phase, null); } }
Example #10
Source File: KeyboardUtil.java From science-journal with Apache License 2.0 | 6 votes |
/** Returns Observable that will receive true if the keyboard is closed */ public static Single<Boolean> closeKeyboard(Activity activity) { View view = activity.getCurrentFocus(); if (view != null) { InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); return Single.create( s -> { imm.hideSoftInputFromWindow( view.getWindowToken(), 0, new ResultReceiver(null) { @Override protected void onReceiveResult(int resultCode, Bundle resultData) { s.onSuccess(resultCode == InputMethodManager.RESULT_HIDDEN); super.onReceiveResult(resultCode, resultData); } }); }); } else { return Single.just(false); } }
Example #11
Source File: CommunicationActions.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
public static void startVoiceCall(@NonNull FragmentActivity activity, @NonNull Recipient recipient) { if (TelephonyUtil.isAnyPstnLineBusy(activity)) { Toast.makeText(activity, R.string.CommunicationActions_a_cellular_call_is_already_in_progress, Toast.LENGTH_SHORT) .show(); return; } WebRtcCallService.isCallActive(activity, new ResultReceiver(new Handler(Looper.getMainLooper())) { @Override protected void onReceiveResult(int resultCode, Bundle resultData) { if (resultCode == 1) { startCallInternal(activity, recipient, false); } else { new AlertDialog.Builder(activity) .setMessage(R.string.CommunicationActions_start_voice_call) .setPositiveButton(R.string.CommunicationActions_call, (d, w) -> startCallInternal(activity, recipient, false)) .setNegativeButton(R.string.CommunicationActions_cancel, (d, w) -> d.dismiss()) .setCancelable(true) .show(); } } }); }
Example #12
Source File: TorchService.java From GravityBox with Apache License 2.0 | 6 votes |
private void maybeProcessStartIntent() { if (mStartIntent == null || mTorchStatus == TORCH_STATUS_UNKNOWN) return; if (ACTION_TOGGLE_TORCH.equals(mStartIntent.getAction())) { if (DEBUG) Log.d(TAG, "maybeProcessStartIntent: ACTION_TOGGLE_TORCH"); toggleTorch(); } else if (ACTION_TORCH_GET_STATUS.equals(mStartIntent.getAction())) { if (DEBUG) Log.d(TAG, "maybeProcessStartIntent: " + "ACTION_TORCH_GET_STATUS: mTorchStatus=" + mTorchStatus); ResultReceiver receiver = mStartIntent.getParcelableExtra("receiver"); Bundle data = new Bundle(); data.putInt(EXTRA_TORCH_STATUS, mTorchStatus); receiver.send(0, data); } mStartIntent = null; }
Example #13
Source File: ImeUtils.java From android-proguards with Apache License 2.0 | 5 votes |
public static void showIme(@NonNull View view) { InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService (Context.INPUT_METHOD_SERVICE); // the public methods don't seem to work for me, so… reflection. try { Method showSoftInputUnchecked = InputMethodManager.class.getMethod( "showSoftInputUnchecked", int.class, ResultReceiver.class); showSoftInputUnchecked.setAccessible(true); showSoftInputUnchecked.invoke(imm, 0, null); } catch (Exception e) { // ho hum } }
Example #14
Source File: LockSettingsService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public void onShellCommand(FileDescriptor in, FileDescriptor out, FileDescriptor err, String[] args, ShellCallback callback, ResultReceiver resultReceiver) throws RemoteException { enforceShell(); final long origId = Binder.clearCallingIdentity(); try { (new LockSettingsShellCommand(mContext, new LockPatternUtils(mContext))).exec( this, in, out, err, args, callback, resultReceiver); } finally { Binder.restoreCallingIdentity(origId); } }
Example #15
Source File: DisplayManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override // Binder call public void onShellCommand(FileDescriptor in, FileDescriptor out, FileDescriptor err, String[] args, ShellCallback callback, ResultReceiver resultReceiver) { final long token = Binder.clearCallingIdentity(); try { DisplayManagerShellCommand command = new DisplayManagerShellCommand(this); command.exec(this, in, out, err, args, callback, resultReceiver); } finally { Binder.restoreCallingIdentity(token); } }
Example #16
Source File: PermissionUtils.java From flutter-incall-manager with ISC License | 5 votes |
private static void maybeRequestPermissionsOnHostResume( final FlutterIncallManagerPlugin plugin, final String[] permissions, int[] grantResults, final ResultReceiver resultReceiver, int requestCode) { /* if (!(context instanceof ReactContext)) { // I do not know how to wait for an Activity here. send(resultReceiver, requestCode, permissions, grantResults); return; } final Context reactContext = (Context) context; reactContext.addLifecycleEventListener( new LifecycleEventListener() { @Override public void onHostDestroy() { } @Override public void onHostPause() { } @Override public void onHostResume() { reactContext.removeLifecycleEventListener(this); requestPermissions(context, permissions, resultReceiver); } }); */ }
Example #17
Source File: Tethering.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private void sendUiTetherProvisionIntent(int type, ResultReceiver receiver) { Intent intent = new Intent(Settings.ACTION_TETHER_PROVISIONING); intent.putExtra(EXTRA_ADD_TETHER_TYPE, type); intent.putExtra(EXTRA_PROVISION_CALLBACK, receiver); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); final long ident = Binder.clearCallingIdentity(); try { mContext.startActivityAsUser(intent, UserHandle.CURRENT); } finally { Binder.restoreCallingIdentity(ident); } }
Example #18
Source File: Tethering.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Enables or disables tethering for the given type. This should only be called once * provisioning has succeeded or is not necessary. It will also schedule provisioning rechecks * for the specified interface. */ private void enableTetheringInternal(int type, boolean enable, ResultReceiver receiver) { boolean isProvisioningRequired = enable && isTetherProvisioningRequired(); int result; switch (type) { case TETHERING_WIFI: result = setWifiTethering(enable); if (isProvisioningRequired && result == TETHER_ERROR_NO_ERROR) { scheduleProvisioningRechecks(type); } sendTetherResult(receiver, result); break; case TETHERING_USB: result = setUsbTethering(enable); if (isProvisioningRequired && result == TETHER_ERROR_NO_ERROR) { scheduleProvisioningRechecks(type); } sendTetherResult(receiver, result); break; case TETHERING_BLUETOOTH: setBluetoothTethering(enable, receiver); break; default: Log.w(TAG, "Invalid tether type."); sendTetherResult(receiver, TETHER_ERROR_UNKNOWN_IFACE); } }
Example #19
Source File: KeyboardUtils.java From tysq-android with GNU General Public License v3.0 | 5 votes |
/** * Hide the soft input. * * @param view The view. */ public static void hideSoftInput(final View view) { InputMethodManager imm = (InputMethodManager) Utils.getApp().getSystemService(Context.INPUT_METHOD_SERVICE); if (imm == null) return; imm.hideSoftInputFromWindow(view.getWindowToken(), 0, new ResultReceiver(new Handler()) { @Override protected void onReceiveResult(int resultCode, Bundle resultData) { if (resultCode == InputMethodManager.RESULT_UNCHANGED_SHOWN || resultCode == InputMethodManager.RESULT_SHOWN) { toggleSoftInput(); } } }); }
Example #20
Source File: Tethering.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private void sendSilentTetherProvisionIntent(int type, ResultReceiver receiver) { Intent intent = new Intent(); intent.putExtra(EXTRA_ADD_TETHER_TYPE, type); intent.putExtra(EXTRA_RUN_PROVISION, true); intent.putExtra(EXTRA_PROVISION_CALLBACK, receiver); intent.setComponent(TETHER_SERVICE); final long ident = Binder.clearCallingIdentity(); try { mContext.startServiceAsUser(intent, UserHandle.CURRENT); } finally { Binder.restoreCallingIdentity(ident); } }
Example #21
Source File: NetworkWatchlistService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public void onShellCommand(FileDescriptor in, FileDescriptor out, FileDescriptor err, String[] args, ShellCallback callback, ResultReceiver resultReceiver) { if (!isCallerShell()) { Slog.w(TAG, "Only shell is allowed to call network watchlist shell commands"); return; } (new NetworkWatchlistShellCommand(this, mContext)).exec(this, in, out, err, args, callback, resultReceiver); }
Example #22
Source File: TinfoilNET.java From ns-usbloader-mobile with GNU General Public License v3.0 | 5 votes |
/** * Simple constructor that everybody uses * */ TinfoilNET(ResultReceiver resultReceiver, Context context, ArrayList<NSPElement> nspElements, String nsIp, String phoneIp, int phonePort) throws Exception { super(resultReceiver, context); this.nsIp = nsIp; this.phoneIp = phoneIp; this.phonePort = phonePort; this.nspMap = new HashMap<>(); // Collect and encode NSP files list for (NSPElement nspElem : nspElements) nspMap.put(URLEncoder.encode(nspElem.getFilename(), "UTF-8").replaceAll("\\+", "%20"), nspElem); // replace + to %20 // Resolve IP if (phoneIp.isEmpty()) resolvePhoneIp(); // Open Server Socket on port try { serverSocket = new ServerSocket(phonePort); } catch (IOException ioe) { throw new Exception("NET: Can't open socket using port: " + phonePort + ". Returned: "+ioe.getMessage()); } }
Example #23
Source File: Util.java From RetroMusicPlayer with GNU General Public License v3.0 | 5 votes |
public static void showIme(@NonNull View view) { InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService (Context.INPUT_METHOD_SERVICE); // the public methods don't seem to work for me, so… reflection. try { Method showSoftInputUnchecked = InputMethodManager.class.getMethod( "showSoftInputUnchecked", int.class, ResultReceiver.class); showSoftInputUnchecked.setAccessible(true); showSoftInputUnchecked.invoke(imm, 0, null); } catch (Exception e) { // ho hum } }
Example #24
Source File: DeviceStorageMonitorService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
void dumpImpl(FileDescriptor fd, PrintWriter _pw, String[] args) { final IndentingPrintWriter pw = new IndentingPrintWriter(_pw, " "); if (args == null || args.length == 0 || "-a".equals(args[0])) { pw.println("Known volumes:"); pw.increaseIndent(); for (int i = 0; i < mStates.size(); i++) { final UUID uuid = mStates.keyAt(i); final State state = mStates.valueAt(i); if (StorageManager.UUID_DEFAULT.equals(uuid)) { pw.println("Default:"); } else { pw.println(uuid + ":"); } pw.increaseIndent(); pw.printPair("level", State.levelToString(state.level)); pw.printPair("lastUsableBytes", state.lastUsableBytes); pw.println(); pw.decreaseIndent(); } pw.decreaseIndent(); pw.println(); pw.printPair("mSeq", mSeq.get()); pw.printPair("mForceState", State.levelToString(mForceLevel)); pw.println(); pw.println(); } else { Shell shell = new Shell(); shell.exec(mRemoteService, null, fd, null, args, null, new ResultReceiver(null)); } }
Example #25
Source File: TinfoilUSB.java From ns-usbloader-mobile with GNU General Public License v3.0 | 5 votes |
TinfoilUSB(ResultReceiver resultReceiver, Context context, UsbDevice usbDevice, UsbManager usbManager, ArrayList<NSPElement> nspElements) throws Exception{ super(resultReceiver, context, usbDevice, usbManager); this.nspElements = nspElements; }
Example #26
Source File: InputMethodManager.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * This method is still kept for a while until android.support.v7.widget.SearchView ver. 26.0 * is publicly released because previous implementations of that class had relied on this method * via reflection. * * @deprecated This is a hidden API. You should never use this. * @hide */ @Deprecated public void showSoftInputUnchecked(int flags, ResultReceiver resultReceiver) { try { Log.w(TAG, "showSoftInputUnchecked() is a hidden method, which will be removed " + "soon. If you are using android.support.v7.widget.SearchView, please update " + "to version 26.0 or newer version."); mService.showSoftInput(mClient, flags, resultReceiver); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
Example #27
Source File: CarrierService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public void getCarrierConfig(CarrierIdentifier id, ResultReceiver result) { try { Bundle data = new Bundle(); data.putParcelable(KEY_CONFIG_BUNDLE, CarrierService.this.onLoadConfig(id)); result.send(RESULT_OK, data); } catch (Exception e) { Log.e(LOG_TAG, "Error in onLoadConfig: " + e.getMessage(), e); result.send(RESULT_ERROR, null); } }
Example #28
Source File: ConnectivityManager.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * Runs tether provisioning for the given type if needed and then starts tethering if * the check succeeds. If no carrier provisioning is required for tethering, tethering is * enabled immediately. If provisioning fails, tethering will not be enabled. It also * schedules tether provisioning re-checks if appropriate. * * @param type The type of tethering to start. Must be one of * {@link ConnectivityManager.TETHERING_WIFI}, * {@link ConnectivityManager.TETHERING_USB}, or * {@link ConnectivityManager.TETHERING_BLUETOOTH}. * @param showProvisioningUi a boolean indicating to show the provisioning app UI if there * is one. This should be true the first time this function is called and also any time * the user can see this UI. It gives users information from their carrier about the * check failing and how they can sign up for tethering if possible. * @param callback an {@link OnStartTetheringCallback} which will be called to notify the caller * of the result of trying to tether. * @param handler {@link Handler} to specify the thread upon which the callback will be invoked. * @hide */ @SystemApi @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) public void startTethering(int type, boolean showProvisioningUi, final OnStartTetheringCallback callback, Handler handler) { Preconditions.checkNotNull(callback, "OnStartTetheringCallback cannot be null."); ResultReceiver wrappedCallback = new ResultReceiver(handler) { @Override protected void onReceiveResult(int resultCode, Bundle resultData) { if (resultCode == TETHER_ERROR_NO_ERROR) { callback.onTetheringStarted(); } else { callback.onTetheringFailed(); } } }; try { String pkgName = mContext.getOpPackageName(); Log.i(TAG, "startTethering caller:" + pkgName); mService.startTethering(type, wrappedCallback, showProvisioningUi, pkgName); } catch (RemoteException e) { Log.e(TAG, "Exception trying to start tethering.", e); wrappedCallback.send(TETHER_ERROR_SERVICE_UNAVAIL, null); } }
Example #29
Source File: InputMethodService.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @MainThread @Override public void showSoftInput(int flags, ResultReceiver resultReceiver) { if (DEBUG) Log.v(TAG, "showSoftInput()"); boolean wasVis = isInputViewShown(); if (dispatchOnShowInputRequested(flags, false)) { try { showWindow(true); } catch (BadTokenException e) { // We have ignored BadTokenException here since Jelly Bean MR-2 (API Level 18). // We could ignore BadTokenException in InputMethodService#showWindow() instead, // but it may break assumptions for those who override #showWindow() that we can // detect errors in #showWindow() by checking BadTokenException. // TODO: Investigate its feasibility. Update JavaDoc of #showWindow() of // whether it's OK to override #showWindow() or not. } } clearInsetOfPreviousIme(); // If user uses hard keyboard, IME button should always be shown. mImm.setImeWindowStatus(mToken, mStartInputToken, mapToImeWindowStatus(isInputViewShown()), mBackDisposition); if (resultReceiver != null) { resultReceiver.send(wasVis != isInputViewShown() ? InputMethodManager.RESULT_SHOWN : (wasVis ? InputMethodManager.RESULT_UNCHANGED_SHOWN : InputMethodManager.RESULT_UNCHANGED_HIDDEN), null); } }
Example #30
Source File: TransferTask.java From ns-usbloader-mobile with GNU General Public License v3.0 | 5 votes |
TransferTask(ResultReceiver resultReceiver, Context context){ this.interrupt = false; this.resultReceiver = resultReceiver; this.context = context; this.createNotificationChannel(); this.notificationBuilder = new NotificationCompat.Builder(context, NsConstants.NOTIFICATION_FOREGROUND_SERVICE_CHAN_ID) .setSmallIcon(R.drawable.ic_notification) .setPriority(NotificationCompat.PRIORITY_LOW) .setContentTitle(context.getString(R.string.notification_transfer_in_progress)) .setOnlyAlertOnce(true) .setOngoing(true) .setContentIntent(PendingIntent.getActivity(context, 0, new Intent(context, MainActivity.class), 0)); }