List of usage examples for android.content Intent FLAG_ACTIVITY_NO_HISTORY
int FLAG_ACTIVITY_NO_HISTORY
To view the source code for android.content Intent FLAG_ACTIVITY_NO_HISTORY.
Click Source Link
From source file:sssemil.com.wifiapmanager.MainService.java
private void showTetheredNotification() { if (mNotificationManager == null) { return;//from w ww . j a v a2 s .co m } Intent intent = new Intent(); intent.setClassName("sssemil.com.wifiapmanager", "sssemil.com.wifiapmanager.MainActivity"); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0, null); CharSequence title = getText(R.string.tethered_notification_title); CharSequence message = getText(R.string.tethered_notification_no_device_message); if (mTetheredNotificationBuilder == null) { mTetheredNotificationBuilder = new NotificationCompat.Builder(this).setSmallIcon(mIcon); } mTetheredNotificationBuilder.setSmallIcon(mIcon).setContentTitle(title).setContentText(message) .setOngoing(true).setContentIntent(pi); mNotificationManager.notify(mIcon, mTetheredNotificationBuilder.build()); }
From source file:at.jclehner.rxdroid.ui.DoseLogFragment.java
@Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { Log.d(TAG, "onChildClick: " + groupPosition + ":" + childPosition); final Date date = getGroupDate(groupPosition); if (date == null) return false; final Intent intent = new Intent(getActivity(), DrugListActivity2.class); intent.putExtra(DrugListActivity2.EXTRA_DATE, date); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(intent);/* w ww. j av a 2 s . com*/ return true; }
From source file:com.molice.oneingdufs.androidpn.Notifier.java
public void notify(String notificationId, String apiKey, String title, String message, String uri) { Log.d(LOGTAG, "notify()..."); Log.d(LOGTAG, "notificationId=" + notificationId); Log.d(LOGTAG, "notificationApiKey=" + apiKey); Log.d(LOGTAG, "notificationTitle=" + title); Log.d(LOGTAG, "notificationMessage=" + message); Log.d(LOGTAG, "notificationUri=" + uri); if (SettingsActivity.getNotificationEnabled(context)) { // Show the toast // if (isNotificationToastEnabled()) { // Toast.makeText(context, message, Toast.LENGTH_LONG).show(); // } // Notification Notification notification = new Notification(); notification.icon = getNotificationIcon(); // notification.defaults = Notification.DEFAULT_LIGHTS; if (SettingsActivity.getNotificationSound(context)) { notification.defaults |= Notification.DEFAULT_SOUND; }/* w ww .j a v a 2s .c om*/ if (SettingsActivity.getNotificationVibrate(context)) { notification.defaults |= Notification.DEFAULT_VIBRATE; } notification.flags |= Notification.FLAG_AUTO_CANCEL; notification.when = System.currentTimeMillis(); notification.tickerText = message; // Intent intent; // if (uri != null // && uri.length() > 0 // && (uri.startsWith("http:") || uri.startsWith("https:") // || uri.startsWith("tel:") || uri.startsWith("geo:"))) { // intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); // } else { // String callbackActivityPackageName = sharedPrefs.getString( // Constants.CALLBACK_ACTIVITY_PACKAGE_NAME, ""); // String callbackActivityClassName = sharedPrefs.getString( // Constants.CALLBACK_ACTIVITY_CLASS_NAME, ""); // intent = new Intent().setClassName(callbackActivityPackageName, // callbackActivityClassName); // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); // } Intent intent = new Intent(context, MessageDetailActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); JSONObject data = formatMetaFromTitle(title); try { data.putOpt("id", notificationId); data.putOpt("content", message); } catch (Exception e) { Log.d("JSON", "Notifier#notify, e=" + e.toString()); } intent.putExtra("data", data.toString()); intent.putExtra("fromNotification", true); // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); // intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); // intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); // intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent contentIntent = PendingIntent.getActivity(context, random.nextInt(), intent, PendingIntent.FLAG_UPDATE_CURRENT); notification.setLatestEventInfo(context, data.optString("title"), message, contentIntent); notificationManager.notify(random.nextInt(), notification); // Intent clickIntent = new Intent( // Constants.ACTION_NOTIFICATION_CLICKED); // clickIntent.putExtra(Constants.NOTIFICATION_ID, notificationId); // clickIntent.putExtra(Constants.NOTIFICATION_API_KEY, apiKey); // clickIntent.putExtra(Constants.NOTIFICATION_TITLE, title); // clickIntent.putExtra(Constants.NOTIFICATION_MESSAGE, message); // clickIntent.putExtra(Constants.NOTIFICATION_URI, uri); // // positiveIntent.setData(Uri.parse((new StringBuilder( // // "notif://notification.adroidpn.org/")).append(apiKey).append( // // "/").append(System.currentTimeMillis()).toString())); // PendingIntent clickPendingIntent = PendingIntent.getBroadcast( // context, 0, clickIntent, 0); // // notification.setLatestEventInfo(context, title, message, // clickPendingIntent); // // Intent clearIntent = new Intent( // Constants.ACTION_NOTIFICATION_CLEARED); // clearIntent.putExtra(Constants.NOTIFICATION_ID, notificationId); // clearIntent.putExtra(Constants.NOTIFICATION_API_KEY, apiKey); // // negativeIntent.setData(Uri.parse((new StringBuilder( // // "notif://notification.adroidpn.org/")).append(apiKey).append( // // "/").append(System.currentTimeMillis()).toString())); // PendingIntent clearPendingIntent = PendingIntent.getBroadcast( // context, 0, clearIntent, 0); // notification.deleteIntent = clearPendingIntent; // // notificationManager.notify(random.nextInt(), notification); } else { Log.w(LOGTAG, "Notificaitons disabled."); } }
From source file:com.dmitrymalkovich.android.githubanalytics.dashboard.DashboardFragment.java
@Override public void signOut() { if (getActivity() != null) { Intent intent = new Intent(getActivity(), WelcomeActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(intent);//w w w . j a va 2s . co m getActivity().finish(); } }
From source file:br.ajmarques.cordova.plugin.localnotification.Receiver.java
/** * Fgt der Notification einen onclick Handler hinzu. *///from w w w . j a v a 2 s. com private NotificationCompat.Builder setClickEvent(NotificationCompat.Builder notification) { Intent intent = new Intent(context, ReceiverActivity.class) .putExtra(OPTIONS, options.getJSONObject().toString()).setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); int requestCode = new Random().nextInt(); PendingIntent contentIntent = PendingIntent.getActivity(context, requestCode, intent, PendingIntent.FLAG_CANCEL_CURRENT); return notification.setContentIntent(contentIntent); }
From source file:com.aokyu.dev.pocket.PocketClient.java
private void continueAuthorization(Activity callback, RequestToken requestToken) { String url = PocketServer.getRedirectUrl(mConsumerKey, requestToken); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP); callback.startActivity(intent);//from w w w . j a v a2s. c om }
From source file:de.appplant.cordova.plugin.localnotification.Receiver.java
/** * Adds an onclick handler to the notification *///from www . j a va2 s . c om private Builder setClickEvent(Builder notification) { Intent intent = new Intent(context, ReceiverActivity.class) .putExtra(OPTIONS, options.getJSONObject().toString()).setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); int requestCode = new Random().nextInt(); PendingIntent contentIntent = PendingIntent.getActivity(context, requestCode, intent, PendingIntent.FLAG_CANCEL_CURRENT); return notification.setContentIntent(contentIntent); }
From source file:de.uni_weimar.m18.anatomiederstadt.LevelListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { /*// w ww .j a va 2 s. c o m String sortOrder = LevelContractOLD.LevelEntry.COLUMN_PATH + " ASC"; Uri levelUri = LevelContractOLD.LevelEntry.CONTENT_URI; Cursor cur = getActivity().getContentResolver().query(levelUri, null, null, null, sortOrder); mLevelAdapter = new LevelAdapter(getActivity(), cur, 0); */ String sortOrder = LevelColumns.BASE_PATH + " ASC"; Uri levelUri = LevelColumns.CONTENT_URI; Cursor cur = getActivity().getContentResolver().query(levelUri, null, null, null, sortOrder); mLevelAdapter = new LevelListAdapter(getActivity(), cur, 0); View rootView = inflater.inflate(R.layout.fragment_main, container, false); ListView listView = (ListView) rootView.findViewById(R.id.listview_levels); listView.setAdapter(mLevelAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { // CursorAdapter returns a cursor at the correct position for getItem() // if it cannot seek to that position Cursor cursor = (Cursor) adapterView.getItemAtPosition(position); long idx = cursor.getLong(cursor.getColumnIndex(LevelColumns._ID)); Log.v(LOG_TAG, "OnItemClickListener id: " + Long.toString(idx)); //Log.v(LOG_TAG, "Uri to intent: " + LevelContractOLD.LevelEntry.buildLevelsUri(idx)); Uri uri = ContentUris.withAppendedId(LevelColumns.CONTENT_URI, idx); Log.v(LOG_TAG, "Uri to intent: " + uri); if (cursor != null) { Intent intent = new Intent(getActivity(), LevelPrepareActivity.class).setData(uri /* LevelContractOLD.LevelEntry.buildLevelsUri(idx) */); intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(intent); } } }); return rootView; }
From source file:com.commontime.plugin.notification.notification.Builder.java
/** * Set intent to handle the click event. Will bring the app to * foreground.//from w ww. j a v a2s . c o m * * @param builder * Local notification builder instance */ private void applyContentReceiver(NotificationCompat.Builder builder) { if (clickActivity == null) return; Intent intent = new Intent(context, clickActivity).putExtra(Options.EXTRA, options.toString()) .setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); int requestCode = new Random().nextInt(); PendingIntent contentIntent = PendingIntent.getActivity(context, requestCode, intent, PendingIntent.FLAG_CANCEL_CURRENT); builder.setContentIntent(contentIntent); }
From source file:org.androidpn.client.Notifier.java
public void notify(String notificationId, String apiKey, String title, String message, String uri, String imageUrl) {/* ww w .jav a 2s .c o m*/ Log.d(LOGTAG, "notify()..."); Log.d(LOGTAG, "notificationId=" + notificationId); Log.d(LOGTAG, "notificationApiKey=" + apiKey); Log.d(LOGTAG, "notificationTitle=" + title); Log.d(LOGTAG, "notificationMessage=" + message); Log.d(LOGTAG, "notificationUri=" + uri); if (isNotificationEnabled()) { // Show the toast if (isNotificationToastEnabled()) { Toast.makeText(context, message, Toast.LENGTH_LONG).show(); } mBuilder.setWhen(System.currentTimeMillis())//? .setPriority(Notification.PRIORITY_DEFAULT)// // .setAutoCancel(true)//????? .setOngoing(false)//ture???,??(?)???,?(,??,) .setDefaults(Notification.DEFAULT_VIBRATE)//???????defaults?? //Notification.DEFAULT_ALL Notification.DEFAULT_SOUND // requires VIBRATE permission .setSmallIcon(getNotificationIcon()); mBuilder.setAutoCancel(true)//? .setContentTitle(title).setContentText(message).setTicker(message); // Notification if (isNotificationSoundEnabled()) { mBuilder.setDefaults(Notification.DEFAULT_SOUND); } if (isNotificationVibrateEnabled()) { mBuilder.setDefaults(Notification.DEFAULT_VIBRATE); } mBuilder.setOnlyAlertOnce(true); // Intent intent; // if (uri != null // && uri.length() > 0 // && (uri.startsWith("http:") || uri.startsWith("https:") // || uri.startsWith("tel:") || uri.startsWith("geo:"))) { // intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); // } else { // String callbackActivityPackageName = sharedPrefs.getString( // Constants.CALLBACK_ACTIVITY_PACKAGE_NAME, ""); // String callbackActivityClassName = sharedPrefs.getString( // Constants.CALLBACK_ACTIVITY_CLASS_NAME, ""); // intent = new Intent().setClassName(callbackActivityPackageName, // callbackActivityClassName); // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); // } Intent intent = new Intent(context, NotificationDetailsActivity.class); intent.putExtra(Constants.NOTIFICATION_ID, notificationId); intent.putExtra(Constants.NOTIFICATION_API_KEY, apiKey); intent.putExtra(Constants.NOTIFICATION_TITLE, title); intent.putExtra(Constants.NOTIFICATION_MESSAGE, message); intent.putExtra(Constants.NOTIFICATION_URI, uri); intent.putExtra(Constants.NOTIFICATION_IMAGE_URL, imageUrl); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent contentIntent = PendingIntent.getActivity(context, random.nextInt(), intent, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(contentIntent); notificationManager.notify(random.nextInt(), mBuilder.build()); } else { Log.w(LOGTAG, "Notificaitons disabled."); } }