2

I am working on an application which fetch the location details in a periodic manner.. i have tried service and broadcastreciever but failed to achieve the location details in particular time frame say 30mins or so.. can any help or suggest me some thing through which i can achieve the location details again and again .. Thnks in adv

Azuu
  • 836
  • 2
  • 16
  • 32
  • have you considered to declare your service as a `LocationListener` which gets updated everytime the GPS sensor retrieves a new location? – herom Jun 27 '12 at 14:33

1 Answers1

2

Have you tried using the Alarm Manager? You can do the following to update location periodically:

1.Register an alarm manager that will call a service every 30 mins.

2.Make sure you acquire a wake lock so that the device wakes up from sleep.

3.The alarm manager takes a pending intent which in turn calls a BroadcastReciever/Service when the alarm is triggered.

4.From this BroadCastReciever call the Service to that will update your location. Check this question for the complete code.Also this.

Community
  • 1
  • 1
Mukund Samant
  • 1,079
  • 7
  • 12