Author Topic: Stuck Wake Locks  (Read 336 times)

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1295
    • View Profile
Stuck Wake Locks
« 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
 
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2510
    • View Profile
Re: Stuck Wake Locks
« Reply #1 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?
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)

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1295
    • View Profile
Re: Stuck Wake Locks
« Reply #2 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%
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs