0

I am getting the GPS value in background. For that Am using Service for background process. If GPS is disabled means, I used the below code.

Intent myIntent = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS); 

It is working when the app is running in the foreground, but it is not working in the background. I also use the AlarmManager and a BroadcastReceiver.

Can anyone please help me?

user1670564
  • 391
  • 2
  • 4
  • 12

1 Answers1

2

Service won't run for long time.You have to use AlaramManager

For Long run process.

See the below post

android: running a background task using AlarmManager

Community
  • 1
  • 1
koti
  • 3,681
  • 5
  • 34
  • 58
  • Thanks!! Yes am using service with Alarm manager and Broadcast Receiver. – user1670564 Oct 22 '12 at 06:19
  • I have followed the same way...But it is not wake-up at particular time in backgorund. Without calling "myIntent" code it is working well both background and foreground. – user1670564 Oct 22 '12 at 06:31