PowerEvents
From Pointui
Provides a way of being notified when power related events occur.
Events
void OnTransition(String powerState)
This event is raised when the backlight state changes, or the device is turned on or off. The powerState String value will be one of the following:
- “On” – the device just was switched on by the user
- “Off” – the device has just been switched off
- “Backlight” – the backlight state has changed to be either on or off
- “Unknown”
EXAMPLE
PowerEvents powerEvents; void Load() { //handler for managing lock when device powered off powerEvents.OnTransition = powerEvents_OnTransition; } void powerEvents_OnTransition(String powerState) { if (state == "Off") { //only lock device if no phone activity if (!(Phone.GetIsTalking() || Phone.GetIsCalling() || Phone.GetIsIncomingCall())) { Device.Lock(); } } }
