Android Question is problem related to keep alive ?

hookshy

Well-Known Member
Licensed User
Longtime User
android 2.3.6

Please watch this video to see at I am facing !
Could be this be ralated in any way with keep_alive function ?

Reproducing the state :
1.The main activity is onfront and keep_alive function is set
2.Power button is pressed
3.see video

Do I have to catch the power button pressed or home button in order to release_keep_alive ?
When do I use release keep_alive ? I do release the function on back key pressed ..when I close the activity .

Thank you

B4X:
Sub keep_alive
Dim ph As PhoneWakeState
   ph.ReleaseKeepAlive
   ph.KeepAlive(True)
End Sub
Sub release_keep_alive
Dim ph As PhoneWakeState
   ph.ReleaseKeepAlive

End Sub
 

lemonisdead

Well-Known Member
Licensed User
Longtime User
I've already seen that behaviour with the Alcatel Pop C7 because of their power management app. The workaround was to kill that app.
 
Upvote 0

hookshy

Well-Known Member
Licensed User
Longtime User
I've already seen that behaviour with the Alcatel Pop C7 because of their power management app. The workaround was to kill that app.

Thanks lemonisdead , happy to know that my phone is not the only one.
As market has 1001 phones models and software is good to know new issues !

I tried to fix this behaviour with the following code which actually worked

'using phone events
B4X:
Sub ev_ScreenOn (Intent As Intent)
   
    If IsPaused(Main)=False AND Main.keepal Then
        Dim phk As PhoneWakeState 
        phk.ReleaseKeepAlive
        phk.KeepAlive(True)
    End If
   
End Sub
Sub ev_ScreenOff (Intent As Intent)
Log("screen off by user")

Dim phk As PhoneWakeState 
phk.ReleaseKeepAlive
     
End Sub
 
Upvote 0
Top