个人冲刺9
作者:互联网
完善开始闹钟开始导入不能使用直接注释掉
package timeline.lizimumu.com.t.util;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
public class AlarmUtil {
public static void setAlarm(Context context) {
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
if (alarmManager != null) {
long start = System.currentTimeMillis();
Intent in = new Intent("ALARM_RECEIVER");
PendingIntent pi = PendingIntent.getBroadcast(context, 0, in, PendingIntent.FLAG_CANCEL_CURRENT);
alarmManager.set(AlarmManager.RTC_WAKEUP, start + 86400 * 1000, pi);
}
}
}
标签:个人,冲刺,AlarmManager,Intent,Context,import,android,PendingIntent 来源: https://www.cnblogs.com/wyq134214/p/16376569.html