0

In my app i have a dashboard activity and it's launch mode is "SingleTask" Are there any chances that my app gets in onNewIntent without onCreate?

For example if user navigates to another activity from Dashboard and after Dashboard is destroyed, what happens if user navigates to dashboard again?

Will onCreate work or just will go on from onNewIntent?

Thanks.

savepopulation
  • 11,736
  • 4
  • 55
  • 80
  • OnNewIntent is not for your scenario. Please learn about Activity lifecycle :https://developer.android.com/guide/components/activities/activity-lifecycle.html#alc – Bos Feb 10 '17 at 08:34

1 Answers1

0

According to the Android API docs, onNewIntent will only get called for:

activities that set launchMode to "singleTop" in their package, or if a client used the FLAG_ACTIVITY_SINGLE_TOP flag when calling startActivity(Intent).

Since you are using SingleTask, onNewIntent should not get called.

See: https://developer.android.com/reference/android/app/Activity.html#onNewIntent(android.content.Intent)

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Eric Levine
  • 13,536
  • 5
  • 49
  • 49
  • OnNewIntent will be called when the singleTask activity started in a task which already includes the activity. – Bos Feb 10 '17 at 08:30