Starting Activity through notification: Avoiding duplicate activities

后端 未结 3 792
小鲜肉
小鲜肉 2020-11-30 21:41

So I am currently showing a notification. When the user clicks this noticiation, the application is started. The notification persists, to indicate that the service is runni

3条回答
  •  半阙折子戏
    2020-11-30 22:03

    That's the way it's supposed to be by default. You probably need to specify android:launchMode="singleTop" if you want to have a single instance only.
    There are 4 launch modes, more info here: https://developer.android.com/guide/topics/manifest/activity-element.html

提交回复
热议问题