Android notification bar open last active activity?

前端 未结 2 1669
半阙折子戏
半阙折子戏 2021-01-03 01:54

I am creating like timer application and when I start timer I have option to go to android Home or start any other activity .

When I start timer I set a notificati

相关标签:
2条回答
  • 2021-01-03 02:22

    I'm not certain I understand what you mean.

    I suppose you could add an extra in the intent to specify which notification exactly was used to invoke your app. Does this help at all?

    0 讨论(0)
  • 2021-01-03 02:28

    I found an answer it's about flags : Android: new Intent() starts new instance with android:launchMode="singleTop"

    Intent intent= new Intent(context, YourActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    
    0 讨论(0)
提交回复
热议问题