How to get a new intention when the activity is brought to the fore?

When using the pendingIntent command to start an activity, and the activity is already active in the background, I cannot get new intentions. getIntent returns the intent that triggered the action , but in this case, Android will simply return it and call onResume. I want to be able to receive new additions to update activity.

How can i do this?

+4
source share
2 answers

try

@Override protected void onNewIntent(Intent intent) { // TODO Auto-generated method stub super.onNewIntent(intent); } 

EDIT: works when setting activity start mode to singleTask

+8
source

The intent is not the same in onCreate and onNewIntent. If the activity start mode is singleTask or singleInstance, you fulfill the intent in two cases. read carefully: http://developer.android.com/reference/android/app/Activity.html#onNewIntent(android.content.Intent)

onNewIntent 를 통해 들어오는 인 텐트 와 onCreate 에서 갖어 오는 인 텐트 (getIntent) 는 다르다.

0
source

All Articles