Android – PendingIntent does not call onCreate
original source : https://stackoverflow.com/questions/31686481/android-pendingintent-does-not-call-oncreate
You’re probably getting the call to onNewIntent
This is 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). In either case, when the activity is re-launched while at the top of the activity stack instead of a new instance of the activity being started, onNewIntent() will be called on the existing instance with the Intent that was used to re-launch
notification을 처리하는 과정에서 pendingIntent를 통해 한번 열어진 activity가 또 다른 notification에 의해 생성된 pendingIntent에 반응하지 않는 문제가 있었다. 첫번째가 아닌 경우에는 onCreate()가 호출 되지 않는다. 대신에 onNewIntent()가 호출됨으로 여기에서 작업을 수행해야 한다.