Back to main activity from notification-created activity

后端 未结 9 2112
粉色の甜心
粉色の甜心 2020-11-30 04:33

I\'m trying to implement the behaviour described here, where a notification (or whatever) starts an \"internal\" activity in your app, and then when the user pressed back it

9条回答
  •  时光取名叫无心
    2020-11-30 05:12

    I know 2 ways of achieving this:

    1. Start your home activity from within activity started by notification. This may become quite trick, as you will have to differentiate and keep track of various possible entry points.
    2. You always start with you home activity which checks if is being started by a notification and then starts the notification activity. This ensures a consistent entry point and the back stack will be there when user press Up key.

    Regards.

提交回复
热议问题