我怎样才能知道,如果屏幕上的android? [英] How can I tell if the screen is on in android?

查看:102
本文介绍了我怎样才能知道,如果屏幕上的android?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android 2.2的(7级)功能 PowerManager.IsScreenOn()返回一个布尔值,为真,如果屏幕打开和虚假如果屏幕关闭。我开发code为Android 1.5(3级)。我如何完成相同的任务在老版本的Andr​​oid?

In Android 2.2 (Level 7) the function PowerManager.IsScreenOn() returns a boolean that is true if the screen is turned on and false if the screen is turned off. I am developing code for Android 1.5 (Level 3). How do I accomplish the same task in older versions of Android?

我不想打开屏幕或关闭在我的code。我只是想知道它是什么。

I do not want to turn the screen on or off in my code. I just want to know what it is.

推荐答案

您可以通过设置的广播接收器的 ACTION_SCREEN_ON ACTION_SCREEN_OFF

You can accomplish this by setting up broadcast receivers for ACTION_SCREEN_ON and ACTION_SCREEN_OFF.

这篇关于我怎样才能知道,如果屏幕上的android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆