How to determine if Android App open from Notification message?

后端 未结 3 1046
渐次进展
渐次进展 2020-12-15 04:42

In general, when i have notification message on the notification bar and click on it. It open the registered App for that message.

On Startup\'s Activity, How to de

3条回答
  •  一生所求
    2020-12-15 05:12

    The Start Activity code would be like this, otherwise after once it comes from GCM notification, from then every time the Activity comes from the Recent list, it will say it comes from GCM notification, which is wrong.

    Intent intent = this.getIntent();
    if (intent != null && intent.getExtras() != null && intent.getExtras().containsKey("JOBID") && (intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0) {
        int jobID = this.getIntent().getExtras().getInt("JOBID");
    
        if (jobID > 0) {
    
        }
    }
    

提交回复
热议问题