No Sleep / Deep sleep on Android

693 views
Skip to first unread message

Carsten Thielepape

unread,
Jan 26, 2013, 4:23:35 PM1/26/13
to kivy-...@googlegroups.com
Hello,

my / (all?) kivy app(s) prevents to let the Android device go into sleep mode after the configured time of Android. Is there any chance to enable this (automatic or manual)?

Greetings

Carsten

Petr Vanek

unread,
Jan 27, 2013, 11:51:30 AM1/27/13
to kivy-...@googlegroups.com
Hi,

to disable wake lock, i commented out some code in SDLSurfaceView.java of your android build environment:

diff SDLSurfaceView.java SDLSurfaceView.javaModified
318c318
<     private PowerManager.WakeLock wakeLock;
---
>     ///private PowerManager.WakeLock wakeLock;
352,353c352,353
<         PowerManager pm = (PowerManager) act.getSystemService(Context.POWER_SERVICE);
<         wakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "Screen On");
---
>         ///PowerManager pm = (PowerManager) act.getSystemService(Context.POWER_SERVICE);
>         ///wakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "Screen On");
437c437
<         wakeLock.release();
---
>         ///wakeLock.release();
455c455
<         wakeLock.acquire();
---
>         ///wakeLock.acquire();

Petr

Carsten Thielepape

unread,
Jan 28, 2013, 6:24:09 AM1/28/13
to kivy-...@googlegroups.com
Hello Petr,

thanks for your post. I first try was not successful.

I changed the file found under
home/kivy/android/python-for-android/dist/default/src/org/renpy/android
I did not did anything else than rebuild the apk.

Did I miss something?

Petr Vanek

unread,
Jan 28, 2013, 7:13:58 AM1/28/13
to kivy-...@googlegroups.com
Hi Carsten,

i don't recall changying anything else, but have a feeling i had to rebuild for a second time for this to work.
If you have multiple building envs, make sur you are building under the same environment which you edited...

Petr

Carsten Thielepape

unread,
Jan 28, 2013, 7:20:14 AM1/28/13
to kivy-...@googlegroups.com
Hi, Petr,

Thanks, I will give it further try this evening (CET). There should a standard way to enable/disable it.....

Carsten Thielepape

unread,
Jan 28, 2013, 2:37:38 PM1/28/13
to kivy-...@googlegroups.com
Hello Pietr,

a short confirmation:

Reloaded latest version from GIT. Made code adjustments, Compiled package. Works like a charme.

Thanks!

Carsten Thielepape

unread,
May 16, 2013, 2:38:33 PM5/16/13
to kivy-...@googlegroups.com

I just updated to Kivy 1.7 . I recognized the the code slightly changed

if ( (Integer)ai.metaData.get("wakelock") == 1 ) {               
        wakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "Screen On");

So it looks like it is possible to set a parameter to prevent wakelock. Any idea how to pass this to the distributesh script?

Mathieu Virbel

unread,
May 16, 2013, 3:51:31 PM5/16/13
to kivy-...@googlegroups.com
--wavelock

:)

Le 16/05/2013 20:38, Carsten Thielepape a �crit :
> --
> You received this message because you are subscribed to the Google
> Groups "Kivy users support" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to kivy-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Ben Rousch

unread,
May 16, 2013, 3:56:09 PM5/16/13
to kivy-...@googlegroups.com
--wakelock ?

On Thu, May 16, 2013 at 3:51 PM, Mathieu Virbel <txp...@gmail.com> wrote:
> --wavelock
>
> :)
>
--
Ben Rousch
bro...@gmail.com
http://clusterbleep.net/

Gabriel Pettier

unread,
May 17, 2013, 5:20:29 AM5/17/13
to kivy-...@googlegroups.com
yeah, i think tito needs to add an iabbrev to his vim config

iabbrev wavelock wakelock

:)

On Thu, May 16, 2013 at 03:56:09PM -0400, Ben Rousch wrote:
> --wakelock ?
>
> On Thu, May 16, 2013 at 3:51 PM, Mathieu Virbel <txp...@gmail.com> wrote:
> > --wavelock
> >
> > :)
> >
> > Le 16/05/2013 20:38, Carsten Thielepape a �crit :
Reply all
Reply to author
Forward
0 new messages