AlarmManager定时器设置
目标:实现每隔20分钟请求一次
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import java.util.Calendar;
public class AlarmManagerUtils {
private Context context;
public static AlarmManager alarmManager;
public static PendingIntent pendingIntent;
private Calendar calendar;
private AlarmManagerUtils(Context aContext) {
this.context = aContext;
}
private static AlarmManagerUtils instance = null;
public static AlarmManagerUtils getInstance(Context aContext) {
if (instance == null) {
synchronized (AlarmManagerUtils.class