KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have an application with notifications that open a certain activity if I click them. I want that, if I click the notification and the activity is already opened, it's not started again, but just brought to front. I thought I could do it with the flag FLAG_ACTIVITY_BROUGHT_TO_FRONT or FLAG_ACTIVITY_REORDER_TO_FRONT , but it keeps opening it again so I have the activity twice. This is my code: event_notification = new Notification(R.drawable.icon, mContext.getString(R.string.event_notif_message), System.currentTimeMillis()); Intent notificationIntent = new Intent(mContext, EventListActivity.class); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); sendNotification(event_notification, notificationIntent, mContext.getString(R.string.event_notif_title), body, Utils.PA_NOTIFICATIONS_ID); Can I manage it with flags or should I store a variable in SharedPreferences to check if it's opened or not? Thanks!
Tags (comma-separated)
Save Edits
Cancel