0

In one of my application I am providing multiple alarm and its working perfectly fine. I want to extend that alarm features with some background internet related tasks. When alarm is set for particular given value application start checking for that value from my server at every interval of 30 seconds. whenever same value is returned the alarm goes off. My server is updated with new data at every 30 seconds.

Right now I am setting multiple alarm with broadcast receiver and different pending intent ids. How should I start to implement? I am confuse between which should I use for this Alarm manager, Services ,Receivers, Handler, AsyncTask?

Any help is appreciated. Thanks.

tausif
  • 56
  • 1
  • 9

1 Answers1

0

You could create a new BroadcastReceiver and set a repeating alarm for every 30 seconds to trigger the receiver when you wish to start polling your server.

The new receiver could then check your server and if the condition is met could call cancel on the alarm manager to cancel the repeating alarm which triggers it.

Jer
  • 610
  • 5
  • 9