We've got a tablet application for which we want to screen to timeout after a certain period, but would like the user to re-enable it by touching the screen instead of the 'power'-button on the side of the device.
What's the best approach (battery performance) to this?
Using a Partial Wake Lock (will the screen react?)
Disable the screen in some way, but keep everything (including touch response) working?
Other?
Any suggestions on this?
Gabriel,
Since this isn't possible by completely turning the screen off, you may want to just want to use a wake lock and dim the screen to its lowest setting as your 'timeout'. This way you can still accept screen touch events and 'wake' it from this state and bring it back to its previous brightness.
We've got a tablet application for which we want to screen to timeout after a certain period, but would like the user to re-enable it by touching the screen instead of the 'power'-button on the side of the device.
This is impossible except perhaps via custom firmware. If the screen is off, it will not respond to touch events.
Another thing you could do is use an app to turn screen off like ScreenStandby since it works in the background and can start on boot as well.
Out of curiosity, how can we go about contacting someone to help in creating a custom firmware like you did Gabriel?
Related
I'm trying to make an android app that can disable the screen when not in use, but can be easily be accessed with out unlocking the phone. The simplest way would be to disable the lock screen I guess. I have tried the disableKeyguard / FLAG_DISMISS_KEYGUARD / FLAG_SHOW_WHEN_LOCKED, but they all appear to no longer be working. My current thinking is that I will need to keep the app from closing, and simply dim the screen, however, since the use case will have the app in use periodically over several hours, I am really looking to avoid this way of doing it.
Is there any way to create an app that can stay active, but sleep when not in use, without requiring an unlock?
Use FLAG_DISMISS_KEYGUARD with FLAG_SHOW_WHEN_LOCKED. If you need to keep the screen on, use FLAG_KEEP_SCREEN_ON. If you need the app to be running while screen is off, use a wakelock.
My friend dim portion is not going to work you because it will still glow in black room and drain battery.
Why don't you just set the application sleep time to 1 second. And on touching back the screen, it will set back to some maximum number for sleep time.
I'm using getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); to turn on the screen programmatically. Is there a WindowManager feature that turns off the screen progrmamatically? I want the user to press a button and then exit out of the activity and turn off the screen.
As far as i know, you cant really turn the screen off (in the traditional sense). You can, however, dim it as much as possible (like the Phone app does for instance, when you move your phone close to your face).
Check THIS answer for the solution. Just modify the code so it doesn't use the onSensorChanged listener.
I'm making an app that uses the Proximity Sensor while a phone call is in progress. My main issue is that the device doesn't turn the screen off when I hold it up against my face (while talking on the phone). If anyone has a solution as to how to fix this, then my problem will be solved.
Right now though, I'm trying to manually switch the screen off to imitate the normal behavior of the phone app. I looked through a lot of other posts about this but most of them seem to have instructions on how to keep the screen turned ON. My case is the exact opposite... how do I programmatically set the device to turn it's screen off? I don't want it to lock itself or sleep (since the phone call will still be in progress), just turn the screen completely off.
Thanks!
Could someone please show me a sample code snippet where you use two buttons; one to turn off and one to turn on the screen. I cant get it to work. Thanks!
I don't understand your question properly. A wake lock is set in your application so that the device screen does not turn off after a particular span of time. how ever you are advised to use this FLAG_KEEP_SCREEN_ON flag and is the best way
Force Screen On
Erm, when the screen is off, how are you hoping to display a button? Unless you mean hardware buttons, in which case I think only the power button can turn the screen back on.
Today I am looking for a way to mimic the behavior I know from my HTC Hero's lock screen: the calendar and alarm clock can put text & drawables there to inform about an upcoming event or an expired alarm. The lock screen remains there in that it must be dragged down to dismiss the shown event and there might also be a Snooze button.
But, first question: is this default Android stuff or HTC Sense specific only??
Second question: If it is a common Android thing, why can't I find anything in Google's Android documentation for the topics "lockscreen" or "lock screen" that comes close to my question? Where's the API for it?
My problem is: I want to inform the user immediately - even if I try a standard notification, the user with a locked screen will have to unlock it and drag down the notifications list to see & clear what's going on. sigh Putting an endlessly playing notification sound there is a hassle as it takes at least two swipes down to stop the sound playing!
Any hints on this?
Thanks!
is this default Android stuff or HTC
Sense specific only?
It is HTC Sense only. You cannot modify the lock screen of the device from SDK code -- only via firmware modifications. Sorry!
It's kind of o long way around the problem...
but the wallpaper is shown on then lockscreen. so you clould write a custom wallpaper to display your info on the lockscreen. (i think).