piks
piks

Reputation: 1673

How to unlock the device when my activity will be launched programmatically?

I am facing one problem regarding unlocking the device when Service launched activity when any alarm occurs. Scenario is :

My application is having activities and service and all activities will get register with service when it gets launched. Service will establish the connection to the server using WiFi, and when server will send any alarm my application has to launch one activity to update to the User that there is some alarm occurs, Now problem is when Device goes to sleep mode and screen becomes dark and device will get locked in that situation when any alarm generates then I have to unlock the screen and screen brightness should regain as it was in active state and then need to launch the activity, but i failed to unlock the screen as well as regain the brightness of the screen while launching the activity.

Please help me to solve this issue with proper code example.

Regards, Piks

Upvotes: 0

Views: 572

Answers (1)

Nikolay Ivanov
Nikolay Ivanov

Reputation: 8935

You should use PowerManager.WakeLock class

Upvotes: 1

Related Questions