开发者

Android - Clicking notification from within creator's application

开发者 https://www.devze.com 2023-03-10 10:10 出处:网络
I am having issues with the flow of my application when clicking the notification I create from my service.

I am having issues with the flow of my application when clicking the notification I create from my service.

Flow without clicking the notification looks like something like this A -> B -> C -> B -> C ....

Activities B and C alternate, but only one instance of each using the intent flag FLAG_ACTIVITY_REORDER_TO_FRONT. It keeps activity A no more than two back presses away. It's great.

But when I add a notification into the mix, we have some undesired behavior. The notification needs to go to C, but I would like to do the exact same behavior as the FLAG_ACTIVITY_REORDER_TO_FRONT so that if the user launches the notification from within our app, no duplicate activities will be created.

Unfortunatel开发者_开发百科y when the notification is clicked, a new task is created for the intent using the flag FLAG_ACTIVITY_NEW_TASK (http://developer.android.com/guide/practices/ui_guidelines/activity_task_design.html). This means that FLAG_ACTIVITY_REORDER_TO_FRONT won't work because it can't see the activity in the original task.

Is there a way to have a single instance of C without sacrificing the activity stack?

0

精彩评论

暂无评论...
验证码 换一张
取 消