开发者

Can we ON or OFF the device programatically?

开发者 https://www.devze.com 2023-04-09 02:00 出处:网络
I know there is a way where we can reboot the device. And it shows immediate result. But my need is as :-

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 a开发者_开发技巧utomatically 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?


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 don't want your phone to receive calls and connect to any networks, enabling/disabling the AirplaneMode by using a AlarmManager (or a Timer) might be a better idea.

0

精彩评论

暂无评论...
验证码 换一张
取 消