Android: How to avoid that clicking on a Notification calls onCreate()

后端 未结 3 1939
深忆病人
深忆病人 2020-12-28 16:52

In my application I notify the user with notifications, if something special happens:

public void triggerNotification(String msg) {
        notificationManag         


        
3条回答
  •  爱一瞬间的悲伤
    2020-12-28 17:32

    I've discovered that if you use Intent contentIntent = new Intent(this, ABC.class); this calls onCreate(); regardless of the flags set.

    Use Intent contentIntent = getIntent(); to skip onCreate(); and that moves to onStart();

提交回复
热议问题