Prevent android device from sleeping ?

Hi,
I am using this code to prevent the phone from sleeping (Black screen),

Screen.sleepTimeout = SleepTimeout.NeverSleep;

But this still doesn’t work in some devices.
Am I doing it right ???

Please help.

Yes, use sleepTimeout is the “right” way the device from sleeping. With devices that I tested (both android and ios) it works correctly (on Unity 4.2).

Create some script to dump the current value to check if is setting correctly and nobody is changing.

If the device that is not working is android could have a chance of a bad implementation from the manufacturer (they suck in programing :P).