0

I used the android.intent.category.LAUNCHER option to make the app start right after the tablet starts up. I made it to keep my app even when I press the home button But there is a problem When the home button is pressed, onCreate of MainActivity is called again. I want to call onCreate only once because it is connected to the hardware. Is there a way?

I cannot use android.intent.action.BOOT_COMPLETED due to circumstances

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
happyswift
  • 31
  • 3
  • 1
    Your concept of what these `Intent` filters do is whole wrong... as well the your concept of the `Activity` lifecycle. Please have a look at the documentation, which explains all of that in detail. – Martin Zeitler Jan 23 '21 at 06:37
  • Please read the activity lifecycle here https://developer.android.com/guide/components/activities/activity-lifecycle – Sovandara LENG Jan 23 '21 at 07:10
  • Please post your manifest in your question. Your question is difficult to understand. specifying `CATEGORY=LAUNCHER` does NOT make your app start on boot. – David Wasser Jan 24 '21 at 16:03

1 Answers1

0

Well, if your activity is a singleTask activity, then this is a 10 year old, known Android bug, happens when you run your application from Android Studio or from Play Store. Should not happen when the app is launched 'normally' by the user. I think there is nothing you can do about it.

Re-launch of Activity on Home button, but...only the first time

keybee
  • 1,498
  • 20
  • 32