tags:

views:

85

answers:

2

Hi guys,

I am trying to detect Screen backlight On / Off.

I've found android.intent.action.SCREEN_OFF related its event.

But I don't know how to use this.

Can you suggest me about how to detect screen backlight on / off ?

I missing some example or sample code.

Thanks in advance.

+1  A: 

Hi,
I think you can have a look at this class. The method isScreenOn() might be what you need.

Sephy
Hi, thanks for response.Is there a permission to use this class ?
I don't think so, if it's not written in the documentation, i suppose not
Sephy
Guys' isScreenOn this method is available on Android 2.1. I am searching this issue on android 1.5. Any suggestion ?Thanks.
you could check the status of the brightness : Settings.System.getInt(getContentResolver(), "screen_brightness"); The value is between 0 and 255. I'm not sure it will work but it's worth a shot.
Sephy
A: 

Create a BroadCastReciever, Add an Intent Filter including your Intent (android.intent.action.SCREEN_OFF).

Just Override the OnRecieve function in the BroadcastReciver with your code.

Be Sure to include the BroadcastReciever in the Manifest File!

good luck! :)

st0le