Code example for AlarmManager

Methods: setInexactRepeating

0
				PendingIntent.FLAG_UPDATE_CURRENT);
 
		AlarmManager alarms = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
 
		if (GotsPreferences.isDevelopment()) 
			alarms.setInexactRepeating(AlarmManager.RTC_WAKEUP, updateTime.getTimeInMillis(),
					AlarmManager.INTERVAL_FIFTEEN_MINUTES, actionTODOIntent);
		else { 
			updateTime.set(Calendar.HOUR_OF_DAY, 20);
			alarms.setInexactRepeating(AlarmManager.RTC_WAKEUP, updateTime.getTimeInMillis(),
					AlarmManager.INTERVAL_DAY * 7, actionTODOIntent);
		} 
 
		Intent weatherBroadcastIntent = new Intent(context, WeatherBroadcastReceiver.class);
		PendingIntent weatherUpdateService = PendingIntent.getBroadcast(context, 1, weatherBroadcastIntent,
				PendingIntent.FLAG_UPDATE_CURRENT);
 
		if (GotsPreferences.isDevelopment()) 
			alarms.setInexactRepeating(AlarmManager.RTC_WAKEUP, updateTime.getTimeInMillis(),
					AlarmManager.INTERVAL_FIFTEEN_MINUTES, weatherUpdateService);
		else { 
			updateTime.set(Calendar.HOUR_OF_DAY, 20);
			alarms.setInexactRepeating(AlarmManager.RTC_WAKEUP, updateTime.getTimeInMillis(),
					AlarmManager.INTERVAL_DAY, weatherUpdateService);
		} 
	} 
}