I have the following code. which is supposed to send a message in logcat at an interval but is not working. There are a lot of similar posts on stackoverflow but I am not able to figure out the problem. Is there a brainiac somewhere that can help me?
<receiver android:name="BoopoohooAlarmReceiver"></receiver>
public void startAlarmManager(long interval){
Context context = getApplicationContext();
Intent intent = new Intent(context, BoopoohooAlarmReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0);
AlarmManager alarmManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.SECOND, 10);
Log.i(DEBUG, "hollaa");
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), interval, pendingIntent);
}
public class BoopoohooAlarmReceiver extends BroadcastReceiver {
private final String DEBUG = "BoopoohooAlarmReceiver";
@Override
public void onReceive(Context context, Intent intent) {
Log.i(DEBUG, "onReceive");
}
}
Thanks.