Stuck Wake Locks

Previous topic - Next topic

MrPlow

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
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

bigsofty

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?
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

MrPlow

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%
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs