I know there is a way where we can reboot the device. And it shows immediate result.
But my need is as :-
I want that when I will be in my class-room my phone automatically goes to OFF. (Lets say at 2:00 PM), and when I will end my class, my phone will automatically ON (Lets say at 5:00 PM).
So I am looking for the ways where I can ON/OFF the device automatically.
Is this possible? If yes how can I do it?
Using android:keepScreenOn="true" is equivalent to using FLAG_KEEP_SCREEN_ON . You can use whichever approach is best for your app. The advantage of setting the flag programmatically in your activity is that it gives you the option of programmatically clearing the flag later and thereby allowing the screen to turn off.
A wakelock is a powerful concept in Android that allows the developer to modify the default power state of their device. The danger of using a wakelock in an application is that it will reduce the battery life of a device.
No. Third party applications do not have the permission to do that.
Check out these links
http://developer.android.com/reference/android/os/PowerManager.html http://developer.android.com/reference/android/content/Intent.html#ACTION_SHUTDOWN
No. Once ot goes off it cannot be turned on. I think you need to totally mute your phone rather than turning it off.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With