Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get new Intent extra when activity is brought to front?

When using a pendingIntent to start an activity and the activity is already active in the background, I can't get the new intent's extras. getIntent returns the intent that started the activity but in this case, Android will just bring it back to front and call onResume. I want to be able to get new Extras in order to update the activity.

How can I do it?

like image 410
Ronen Yacobi Avatar asked Dec 26 '22 21:12

Ronen Yacobi


1 Answers

try

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

EDIT: Works when setting the activity launchmode to singleTask

like image 142
Mohsin Naeem Avatar answered Feb 23 '23 10:02

Mohsin Naeem