Hi, We have an app that is presented in a single-app kiosk launcher (Airdroid Biz) on devices that we own and control completely. There are multiple processes, but each process calls activity.finshed before going on the next one. On the final process, there is an "Exit App" button that does some file cleanup and then calls:
The issue with that is that while the device (Android 10) returns to the launcher screen correctly, the next time you launch it from the launcher, it crashes immediately with the log error "java object not initialized (label)". I believe this is because the OS is using some (but not all) of the process code retained in memory to do the restart. If you try launching again, it works without error. So, it's not terrible, just ugly for the user.
When I changed to ExitApplication, we do not get this behavior and everything is fine. There is a brief moment when the native app tray is shown, but it doesn't matter because nothing is enabled there.
I believe it works because ExitApplication is well and truly getting rid of everything (except prior permissions) that is stored anywhere and would be part of a restart. But I am cautious about going against all the advice from the most expert people here never to use ExitApplication so I thought I would make this post. (I did not use Pages, by the way, because I started this project well before that wonderful thing existed, and I never need to return to earlier processes in my program flow.)
B4X:
Dim jo As JavaObject
jo.InitializeContext
jo.RunMethod("finishAffinity", Null)
The issue with that is that while the device (Android 10) returns to the launcher screen correctly, the next time you launch it from the launcher, it crashes immediately with the log error "java object not initialized (label)". I believe this is because the OS is using some (but not all) of the process code retained in memory to do the restart. If you try launching again, it works without error. So, it's not terrible, just ugly for the user.
When I changed to ExitApplication, we do not get this behavior and everything is fine. There is a brief moment when the native app tray is shown, but it doesn't matter because nothing is enabled there.
I believe it works because ExitApplication is well and truly getting rid of everything (except prior permissions) that is stored anywhere and would be part of a restart. But I am cautious about going against all the advice from the most expert people here never to use ExitApplication so I thought I would make this post. (I did not use Pages, by the way, because I started this project well before that wonderful thing existed, and I never need to return to earlier processes in my program flow.)