Closed razzbee closed 7 years ago
Are you sure you haven't enabled it in Developer settings
or in a similar OS settings? Don't you have it connected via USB or something? The basic app isn't able to make Android stay awake.
the same happens even without usb attached , besides I havent enabled 'Stay Awake' mode in developers settings (Off)
Can you provide the APK and/or the code?
let me send apk , do I upload it here?
App Uploaded here : http://playslack.com/mediamate.apk
I have opensourced the core part (as planned ) docs is not very good , but that should at least help. https://github.com/razzbee/kivy-android-webview
any solution yet?
The apk seems corrupted for some reason, can't open it on both phone or pc. However, the code doesn't seem to have any issues with the lock itself. Have you tried it on some other device with higher/lower/same android version? Apparently if the apk is really corrupted, you'll need to paste here the AndroidManifest.xml
file.
I still think it's something enabled on your device that forbids the phone to sleep.
I have reuploaded the apk , http://playslack.com/mediamate.apk , again the app crashes for android version less than 4.4
Confirmed, yet I have no clue why. App doesn't use any related permission to wake lock (check manifest), I have no such option enabled and even the code seems to be correct. Webview bootstrap too.
Android 4.4.2
okay , but about this launch crash on android < 4.4 , is there any solution to that?
Lowering minimal api for your app, otherwise I don't know. Logcat would be needed for the crash.
I think te non sleep mode is not from my code , because I tried compiling hello world and had the same bug, tried on android 5 & 6 devices
Well I figured out that this error happens with the sdl2 backend , pygame backend doesnt have this bug
@inclement I tested it with both pygame and sdl2 launchers + that testapp_setup
:
any idea why? Webview isn't build upon sdl2, is it?
I cant use the pygame bootstrap , app crashes randomly with the pygame bootstrap , Please is there a fix for sdl2 bootstrap??
@inclement , @tito PLEASE can you investigate into this since its not only webview apps, any app I compile using the sdl2 bootstrap prevents device from entering sleep mode
@razzbee, why not just have your program stop after a set amount of time? Then the device will do it's normal sleep routine. Also if you want the device to sleep and still want to do things then you should make a service. If you service has forefront priority with a icon in the menu you can also get rid of that using some pyjinus; I put some code for that into the wiki.
I have posted a demo , you can test it, besides , have you tried the new toolchain with sdl2 bootstrap (using buildozer) : http://playslack.com/mediamate.apk
I've checked the wakelock defaults, but it does default to 0 as it should. I guess this depends on something slightly different, and I'll keep looking into it.
It looks like this is the Android manifestation of SDL2's screensaver suspension by default, as described here. You can try setting the env var as explained there as a temporary workaround. I'll look at a proper fix sometime soonish.
This might be a silly question to ask but any idea on how to set the ENV variable in my code ???
I was thinking it would be sufficient to add from os import environ; environ['SDL_VIDEO_ALLOW_SCREENSAVER'] = '1'
at the top of your python file (before any other imports). On reflection I'm not sure if that is early enough, but it should be okay.
Thank you, I will try it and give you the feedback
On 13 January 2017 at 18:12, Alexander Taylor notifications@github.com wrote:
I was thinking it would be sufficient to add from os import environ; environ['SDL_VIDEO_ALLOW_SCREENSAVER'] at the top of your python file (before any other imports). On reflection I'm not sure if that is early enough, but it should be okay.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kivy/python-for-android/issues/969#issuecomment-272507059, or mute the thread https://github.com/notifications/unsubscribe-auth/AC3Si_KxIKoGJe2bi2xMuiMJdXgpAr-5ks5rR76fgaJpZM4LVfpu .
I've just checked this myself, and adding this env var does allow the device to sleep properly. I'm looking at how this should be fixed fully in Kivy.
Hello I have successfully compiled and installed my kivy app on android 6 device , but the device doesnt go on sleep mode even though I havent enabled wake lock
I am using the master branch of kivy , python for android and buildozer. Thank you