android - Recursive IntentService with AlarmManager -
this more or less design question; nonetheless. have intentservice fires off pendingintent calls every 15 minutes.
my question is, alarmmanager; should using either:
set(...)orsetrepeating(...)
the problem noticed setrepeating(...) i'll infinite loop, imagine because of start time. if use set(...); works expected without infinite loop; design question should using setrepeating(...) on adding set(...) after every alarm call? if so, how can without infinite loop while having recursive intentservice calls each time alarm goes off?
both set , setrepeating okay.
set easier follow. have control on when intentservice launched next.
i recommend use of setrepeating: why repeat yourself? infinite loop issue, save boolean value in sharedpreferences when set alarm. on next launch of intentservice, check value. if true, alarm set. else, must first launch: set repeating alarm.
you need implement receiver listens boot_completed action. when intent received, set repeating alarm without checking sharedpreferences value. set value true after issuing setrepeating request.
Comments
Post a Comment