I'm Jumping trough hoops (well, it's not that complicated ofcourse) to avoid starting an alarm twice. The basic code goes like this:
AlarmManager mgr=(AlarmManager)getSystemService(Context.ALARM_SERVICE);
Intent i=new Intent(this, MyService.class);
PendingIntent pi=PendingIntent.getService(this, 0, i, 0);
mgr.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(), AlarmManager.INTERVAL_FIFTEEN_MINUTES, pi);
Would it matter if I would actually run this code everytime my app starts? I'm not seeing any ill effects when calling this about 10 times as an overkill-experiment, but I can't find any reference as to if this is coincidence or expected behavior.
If it is not especially expected, it feels 'wrong'. It might get me in to trouble later if the behavior of the AlarmManager
changes.