I am building an app with multiple Activities and don't want the phone to go to sleep when the app is active.
If I use:
in the main activity, it is working, but the phone stays alive also after I ended the app. So I have to use:
to kill KeepAlive.
But then the phone keeps going to sleep, if I call another activity.
Do I have to use
in every activity or is there a way to call "ReleaseKeepAlive" when I exit an app, not only when I end an activity?
If I use:
B4X:
Dim Awake As PhoneWakeState
Sub Activity_Create(FirstTime As Boolean)
Awake.KeepAlive(True)
in the main activity, it is working, but the phone stays alive also after I ended the app. So I have to use:
B4X:
Sub Activity_Pause (UserClosed As Boolean)
Awake.ReleaseKeepAlive
End Sub
But then the phone keeps going to sleep, if I call another activity.
Do I have to use
B4X:
Awake.KeepAlive(True)
and
Awake.ReleaseKeepAlive