summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod/receiver/AlarmUpdateReceiver.java
blob: 05914a0e1cc48f23f8dc261ed608026595b973ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package de.danoeh.antennapod.receiver;

import de.danoeh.antennapod.AppConfig;
import de.danoeh.antennapod.preferences.UserPreferences;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

/** Listens for events that make it necessary to reset the update alarm. */
public class AlarmUpdateReceiver extends BroadcastReceiver {
	private static final String TAG = "AlarmUpdateReceiver";

	@Override
	public void onReceive(Context context, Intent intent) {
		if (AppConfig.DEBUG)
			Log.d(TAG, "Received intent");
		if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
			if (AppConfig.DEBUG)
				Log.d(TAG, "Resetting update alarm after reboot");
		} else if (intent.getAction().equals(Intent.ACTION_PACKAGE_REPLACED)) {
			if (AppConfig.DEBUG)
				Log.d(TAG, "Resetting update alarm after app upgrade");
		}

		UserPreferences.restartUpdateAlarm(UserPreferences.getUpdateInterval());

	}

}