KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Ive seen many examples of how to make something happen when the user clicks on a notification but I actually don't want anything to happen. If the user clicks on the notification I want the notification to simply dissapear and the user NOT taken anywhere. In my code below, while FLAG_AUTO_CANCEL clears the notification from the status bar, when the user clicks on a my notification they are taken to "MyActivity". How can I create a notification that does nothing? Notification notification = new Notification(R.drawable.success, res.getString(R.string.messages_sent), System.currentTimeMillis()); //Define the expanded message and intent Context context = getApplicationContext(); CharSequence contentTitle = res.getString(R.string.messages_sent_ellipsis); Intent notificationIntent = new Intent(this, MyActivity.class); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0 ); notification.setLatestEventInfo(context, contentTitle, mStrSuccessMessage, contentIntent); notification.flags |= Notification.FLAG_AUTO_CANCEL; //Pass the notification to the notification manager mNotificationManager.notify(1, notification);
Tags (comma-separated)
Save Edits
Cancel