-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an option to dim the screen to avoid killing the battery #49
Comments
After investigating, I'm not sure this is actually possible. I can't find in the API where I can manually dim the screen without shutting off the Activity entirely. |
Don't you just need to set the activity's There's a PhoneGap plugin I've used that does just that. |
Yeah, but it's complicated because apparently the API has been deprecated/changed since 4.0. Anyone interested is free to take a crack at the code, though! |
The docs don't seem to indicate that it was deprecated. (Compare to the |
I don't have any insight into Android development, but I think you don't need to dim the screen programatically, just let Android do it itself. Both Unsleep [1] and Keep screen on! [2] are able to do that on Android 4.4. The latter has an option of [1] https://play.google.com/store/apps/details?id=com.nealc.unsleep |
OK, so maybe the fix is to use the new 4.4 option in post-4.4? I'm happy with deprecating pre-4.4 and shipping only a minSdk=19 APK from now on. |
I have no idea whether the stuff I mentioned is new in 4.4. I just know it works on 4.4, that's the only version I can test :-) Keep Screen On! supports 2.0 and higher and references http://developer.android.com/reference/android/os/PowerManager.html in its description. Unsleep supports 2.3.3 and higher and there's no information how it does it. http://developer.android.com/reference/android/os/PowerManager.html#SCREEN_DIM_WAKE_LOCK says it's deprecated and suggests http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_KEEP_SCREEN_ON , but that flag doesn't seem to support dimming (the documentation says Maybe the deprecated option would be good enough for the time being? |
Currently KeepScore can destroy a phone's battery, because having the screen on eats a ton of power. During a two-hour game of Rummy, the battery on my Galaxy Nexus running Android 4.2 dropped almost 20%.
Turning the screen off entirely is not an option, because we don't want to make users unlock their lockscreen over and over again. (Especially because your friends probably don't know your password.) But dimming the screen after a certain timeout might offer some battery savings.
The text was updated successfully, but these errors were encountered: