I had a massive reading and still I think there is not a clear/complete Answer to this question.
First some stuff to clarify :
this question is not concern with battery saving on phone but more about precise timing and I Am a newbie in Android.
Now let me explain the question in more depth. I have a Alarm manager that will invoke a toast (for simplicity) on given interval (every 2 minutes) manager.setRepeating(AlarmManager.RTC_WAKEUP,System.currentTimeMillis(), interval, pendingIntent);
The above will invoke a onReceive() methode on a BroadcastReciver.
public class AlarmReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
//Toast ....bala blah
}}
Now This was exact interval on API<19 however In API=>19 setRepeating() is not exact anymore ! I found some people suggested (on the other forms) to use setExact(). but there is no example or clear explanation on how to use setExact() in Interval (or I could not find that). As far as I understood setExact() is on off action unlike setRepeating() so according to some others next schedule needs to be set through onReceive() (again I could not find an example ;( . Anyhow this is where I am now . And I really Appreciate any comment or suggestion or link or example ...
I hope I asked my question clear enough, by the way if there is another approach to this (for running a task on precise intervals in API>19 please let me know too) Many thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…