mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
remove unused PersistentAlarmManagerListener
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
package org.thoughtcrime.securesms.service;
|
||||
|
||||
|
||||
import android.app.AlarmManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
public abstract class PersistentAlarmManagerListener extends BroadcastReceiver {
|
||||
|
||||
private static final String TAG = PersistentAlarmManagerListener.class.getSimpleName();
|
||||
|
||||
protected abstract long getNextScheduledExecutionTime(Context context);
|
||||
protected abstract long onAlarm(Context context, long scheduledTime);
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
long scheduledTime = getNextScheduledExecutionTime(context);
|
||||
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
||||
Intent alarmIntent = new Intent(context, getClass());
|
||||
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, alarmIntent, 0);
|
||||
|
||||
if (System.currentTimeMillis() >= scheduledTime) {
|
||||
scheduledTime = onAlarm(context, scheduledTime);
|
||||
}
|
||||
|
||||
Log.w(TAG, getClass() + " scheduling for: " + scheduledTime);
|
||||
|
||||
alarmManager.cancel(pendingIntent);
|
||||
alarmManager.set(AlarmManager.RTC_WAKEUP, scheduledTime, pendingIntent);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user