I already created a bouncing object as an application but I want to make it to be a screensaver.
After 15 seconds inactivity device instead of sleep, the screen shows the screensaver(bouncing object) and quit to the previous screen when the screen is touched.
For the touch action, I currently use onUserInteraction() and it works fine.
I want the screen to show after the device has been in an inactivity period for a while.
*not the DayDream one because DayDream works only when the phone is charged or docked
Related
I use Corona for my game, but when I build into my Android smartphone there is a problem that the screen does not stay on (goes to sleep). My question is how to make the screen stay on having to interact with screen?
You can use system.setIdleTimer() to control the idle timer.
Controls whether the idle timer is enabled. If set to true, the timer will be active (default) or inactive if false. When active, the idle timer dims the screen and eventually puts the device to sleep when no user activity occurs (e.g. screen touches).
Example:
system.setIdleTimer(false) -- Screen does not turn off automatically
system.setIdleTimer(true) -- Screen turns off automatically
I have a program which runs another program.
I want to prevent the user from pressing the power button to turn the screen off and if the user turned the screen off , my program turns it back on!
For this I implement a broadcast receiver that catches the screen off event, then it calls a service to run an activity and in this activity I will turn the screen on and that activity then runs my desired program ...
This plan works fine when I'm not running that app and the screen goes on when the user presses the power button! But when my desired application is running, my program does not work properly in the background! Sometimes it turns the screen on, sometimes it doesn't!
When I play Ingress, Ingress remains active. Even when my screen goes black, if I push the power button, Ingress is still active. I do not need to unlock my phone nor wait for it to "wake up". (The phone is locked though - to use any other app I need to unlock the phone.)
How do I get the same functionality for my camera app?
If I'm using the phone as a camera, with the camera app active, if the screen goes black, when I hit the power button, I want the camera to be open and active.
Things I've tried:
* Keeping my phone unlocked when in paired to a trusted Bluetooth advice. Then when I push the power button, I get a screen where I have to swipe to wake it up. With Ingress, I don't have to swipe the screen nor wait for anything.
* Snapshot. I've tried using the Snapshot app, but I have to wait for the phone to launch the camera app.
* The camera on swipe from the lock screen ... and again I have to wait for the camera app to launch.
I'm willing to figure out how to build my own app if needed. (But would rather find something.)
I'm willing to take a battery hit.
Android 4+
We're developing a lock screen app (not a widget). The app listens for SCREEN_OFF, and generates the activity, so that when SCREEN_ON is received, the user sees the activity in front of the security features using FLAG_SHOW_WHEN_LOCKED.
We've found that on rare occasions around 1 in every 50 to 100 times, the activity appears behind the Home screen rather than in front of the lock screen. We cannot replicate the issue, and it doesn't appear to happen when connected for debugging (I've sat and locked/unlocked my phone and not seen it, then taken the cable out and it happens in the next few times).
The activity appears to display over the wallpaper, with the home screen icons over the top of the activity.
3 questions:
1) Is it possible to "listen" for when the home screen gets started so that we could just finish() the activity at that point?
2) Is it possible to ensure that the activity runs over the lock screen all the time?
3) How would you test this to try to replicate the fault? I cannot figure out why it does it at all and cannot replicate it.
TIA
I want to control my android smartphone that after my son playing games on my phone after a specified time such as half an hour, the phone will be locked unless you submit the right password.
I don't know how to trigger the lock screen process.
How can I implement interrupting the games processes and lock the cellphone?
How unlock and lock screen programatically in android Has some excellent information on immediately calling the lock screen. You could implement a system using an alarm manager to trigger this event.
Here is a good example,
first thing you need to do this, U need to know when the screen gets unlock. So here you go.....
android-detect-phone-unlock-event-screen-on
After that you set a time for 30/40/50 minutes (as you wish).
Once the timer fires, use below link to lock your screen.
lock-phone-screen-programmtically
And your work is done.