开发者

How to call the event "screen_off", when running my app?

How 开发者_如何学Goto call the event "screen_off", when running my app? for example 5 seconds after the start


in displayOffTime=5*1000;//5 seconds

following code will make screen off after 5 seconds

Settings.System.putInt(context.getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, displayOffTime);


This will turn the screen off for the specified amount of time:

PowerManager manager = (PowerManager) getSystemService(Context.POWER_SERVICE);
manager.goToSleep(int amountOfTime);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜