GLBasic forum

Main forum => GLBasic - en => Topic started by: MrPlow on 2018-Mar-20

Title: Stuck Wake Locks
Post by: MrPlow on 2018-Mar-20
Anyone got any good solutions to avoid this for fast paced games on Android?

Basically I monitor the pause state and if paused I tend to only draw a basic pause screen.

Is anyone doing anything different?

Code (glbasic) Select

IF app_pause=0

updatestuff()
drawstuff()

ELSE

drawpausescreen()

ENDIF


myshowscreen()


SUB GLB_ON_PAUSE:
app_pause = 1

music.pause()
IF ISMUSICPLAYING()=TRUE THEN STOPMUSIC

ENDFUNCTION
Title: Re: Stuck Wake Locks
Post by: bigsofty on 2018-Mar-22
Not doing mobile at all just now but I actually set a global variable to match the pause state. This is because it seems that pausing/unpausing on desktop seems to run the main loop for a few frames after the pause state has been initialised. This causes my music to be out of sink as it was paused on the on pause event rather when the main loop was paused. So I actually pause my music + mainloop depending on the pause var. Not sure if Android has this problem?
Title: Re: Stuck Wake Locks
Post by: MrPlow on 2018-Apr-16
Removing this permission seems to be working for me...

<uses-permission android:name="android.permission.WAKE_LOCK" />

Stuck partial wake locks
0.38%
0.20%
Stuck partial wake locks (background)
0.36%
0.18%