My ionic app keeps restarting instead of resuming from last active page

Viewed 434

I am creating an android app built with angualar/ionic 5. and currently testing with android studio via enabled debugger on an android device. The apps works well except for one issue.

The app, when minimized or drawn from the active apps lists restarts instead of resuming to the last active page. I am using angular/ionic 5 and I don't believe this is an issue angular/ionic router since this works fine in pwa/browser versions of the app.

I may be wrong but seems to think this may be due to some missing config for android platforms in config.xml . In my search I came across this

1. <preference name="AndroidLaunchMode" value="singleTask"/> //adding this to config.xml but it did'nt work.
  1. some comments suggested memory leaks may be causing android to shut the app down when it's not in the foreground but tracking the apps memory usage in android studio, it seems to be within acceptable range

  2. My conclusion is that perhaps a problem with ionic/capacitor/cordova core or some bug

This is driving me nuts! If any one has had this problem, how did you solve it please?. and for those experienced ionic developers . what and where would you be looking at if you this issue. Thank you

2 Answers

I tried a different device on the emulator and it worked also tried a different physical device and it worked. this means that the problem is with my particular device. that leaves a lot of questions since a lot of people use my android brand with similar specifications. will the app exhibit same behaviour when downloaded from the playstore? or this is just an android testing and debugging problem.. i will inform you all of what will come later . thank you

In this case I would suggest you to check your device setting you might have mistakenly added this application in battery optimization mode.

Please check your setting I belive this is the culprits. Not your code

Thanks

Related