I want to make some external service monitor and be notified on problems as fast as possible.
I tried to set up AlarmManager
with 1-2 minutes interval,
Calendar cal = Calendar.getInstance();
cal.add(Calendar.SECOND, 30);
Intent intent = new Intent(MainActivity.this, YourClass.class);
PendingIntent pintent = PendingIntent.getService(MainActivity.this,
0, intent, 0);
AlarmManager alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
alarm.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
60* 1000, pintent);