0

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

piks
  • 1,621
  • 8
  • 32
  • 59
  • You can get your answer from the below link..... http://stackoverflow.com/questions/3621599/wake-android-device-up/4541982#4541982 – himanshu Dec 16 '11 at 09:09

1 Answers1

1

You should use PowerManager.WakeLock class

Nikolay Ivanov
  • 8,897
  • 3
  • 31
  • 34
  • Thanks Nikolay, I used PowerManager.WakeLock to get and acquire the lock in my service onCreate method and I am able to achieve my requirement. Thanks once again. – piks Dec 19 '11 at 09:42