1

I want to continue running my application when the back light and screen lock. Is it possible or not. Anybody kindly guide me?

timer Function
receiver

are running in Background. Inside the receiver I am getting the Data.

Usama Sarwar
  • 8,922
  • 7
  • 54
  • 80
Mercy
  • 1,862
  • 9
  • 39
  • 75

3 Answers3

2

If you are using Timer to manage your Application, I would insist that you should use AlarmManager which is an inbuilt Android Facility that Android knows better. In Timer the problem can be that when Android seeks resources for any other Application or something like that it may kill your Timer thread and get the resources where as it won't kill the AlarmManager service that is running because that is what Android knows. You can check my question here to get further idea.

Community
  • 1
  • 1
Lalit Poptani
  • 67,150
  • 23
  • 161
  • 242
  • ya Superb.i will try with Alarm manager and contact with you as soon.and one more Question.if screen is locked,recevier is still running? – Mercy Jan 25 '12 at 06:23
  • yes everything works fine in mycase as I had tried. But you should check it once in your case and which device you are using? – Lalit Poptani Jan 25 '12 at 06:24
0

Following source will help you to unlock the screen.I hope this will help you a bit.

KeyguardManager mKeyGuardManager = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
     KeyguardLock mLock = mKeyGuardManager.newKeyguardLock("your_activity_name");
      mLock.disableKeyguard();
Finder
  • 1,217
  • 5
  • 18
  • 46
  • ya karthick am trying this.But my Application is for Customer purpose.Its not good for our requirements.is any other way to solve the problem – Mercy Jan 25 '12 at 05:58
0

Here Code tht will help you

KeyguardManager   mKeyGuardManager = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
KeyguardLock   mLock = mKeyGuardManager.newKeyguardLock("activity_classname");
mLock.disableKeyguard();

And this is the Reference Link

Parag Chauhan
  • 35,760
  • 13
  • 86
  • 95