Back to main activity from notification-created activity

后端 未结 9 2131
粉色の甜心
粉色の甜心 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:10

    There is a new guide on how to do this, and it suggest some slightly different practices than the answers above:

    https://developer.android.com/guide/topics/ui/notifiers/notifications.html#NotificationResponse

    Note, don't actually use 0 for your requestCode in getPendingIntent. For me any number not 0 worked, but 0 resulted in the back button just going to the launcher.

提交回复
热议问题