1

My Application onCreate is not calling when the notification access enabled.It calls only when I update the app or When I disable the notification access of my app.Here are the scenarios I found by debugging the app.

Condition 1 - onCreate Not Calling when Notification Access Enabled

i) I tried to kill the app.But Application onCreate not called

ii) It calls only One time when the app is launching

Condition 2 - onCreate called

i) It calls when I kill the app

ii) Notification Access disabled

mob_web_dev
  • 2,342
  • 1
  • 20
  • 42

1 Answers1

1

When you open the activity onCreate will execute once. So next time you open the same activity from Notification which you have already opened it wont execute the onCreate.So use onNewIntent

manifest

<activity android:name="ActivityName" android:launchMode="singleTask">

then in your Activity

protected void onNewIntent(Intent intent) {
  super.onNewIntent(intent);
  //here you will get the intent
}
Sabeer
  • 3,940
  • 1
  • 24
  • 20