Android Question Prevent Android ActivityManager from closing the application

Luis Felipe Andrade

Member
Licensed User
I have a kiosk-style application that has no interaction with the user, it only shows jpg images one after the other in full screen. Recently, on all TVBOX-type devices with Android 12.1, the operating system closes the application because it detects that it is inactive and has no user intervention. To detect this I ran a logcat of the device and with this detect the reason why the application closes after a certain time, is there a way to prevent the activitymanager from closing the application due to inactivity?

12-29 13:33:23.640 4276 5743 I ActivityManager: Force stopping com.bzmonitor appid=10058 user=0: from pid 5289
12-29 13:33:23.641 4276 5743 I ActivityManager: Killing 24339:com.bzmonitor/u0a58 (adj 0): stop com.bzmonitor
12-29 13:33:23.642 4276 5743 D ActivityManager: cleanUpApplicationRecord -- 24339
12-29 13:33:23.655 4276 5743 W ActivityManager: Scheduling restart of crashed service com.bzmonitor/.httputils2service in 1000ms
12-29 13:33:23.655 4276 5743 W ActivityManager: Scheduling restart of crashed service com.bzmonitor/.starter in 1000ms
12-29 13:33:23.667 4276 5743 W ActivityManager: Force removing ActivityRecord{d67ff72 u0 com.bzmonitor/.main t6854}: app died, no saved state
* No other apps are running (just Operating Systems, Some Factory Apps and my app)
* All 3 party software has ben removed
* All Battery Options are disabled
*All Screen Saver or sleep mode are disable
*The app Works just fine, no crashes form the app
*The app works just fine with old Android Version

Thank you in advance for your comments!
 

MarcoRome

Expert
Licensed User
Longtime User
Have you tried adding the following code to Main ?

B4X:
'No standby
Dim nowake As PhoneWakeState
nowake.KeepAlive(True)
 
Upvote 0

Luis Felipe Andrade

Member
Licensed User
Have you tried adding the following code to Main ?

B4X:
'No standby
Dim nowake As PhoneWakeState
nowake.KeepAlive(True)
Thank you MArcoRome for your answer, the device in fact does not sleep, Adroid Kill my process becouse is not interacting by the user, but is a digital signage, It supposed to keep running all the time
 
Upvote 0
Top