문제

I'm a bit confused with pending intents in the notification builder. I've got a MainActivity activity and a MessageList activity. I have a service to show a notification when a new message in found, and I want it to be that if the user presses the notification it opens to the MessageList activity but when they press back they will return to the activity they were in.

Essentially I want to add MessageList activity to the top of the activity stack when they press the notification without modifying the current activity stack.

Thank you

도움이 되었습니까?

해결책

Okay, so I got it to work with some old code I wrote a while back. This does what I wanted -

Intent notificationIntent = new Intent(this, AlertListActivity.class);

PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);

mBuilder.setContentIntent(contentIntent);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top