本人用alarmmanager设置了定时任务,但是锁屏的时候根本不会执行。查了大量资料,还是无法解决,有好的办法吗?(测试手机:华为相关代码如下:
if (Build.VERSION.SDK_INT >= 19) {
mAlarmManager.setExact(AlarmManager.RTC_WAKEUP,
course.getStartTime().getTimeInMillis(),
vibrationPI);
mAlarmManager.setExact(AlarmManager.RTC_WAKEUP,
course.getEndTime().getTimeInMillis(),
normalPI);
} else {
mAlarmManager.set(AlarmManager.RTC_WAKEUP,
course.getStartTime().getTimeInMillis(),
vibrationPI);
mAlarmManager.set(AlarmManager.RTC_WAKEUP,
course.getEndTime().getTimeInMillis(),
normalPI);
}
public class SetVibrationService extends IntentService {
private static final String NAME = "SetVibrationService";
private static final int NOTIFICATION_ID = 1;
public SetVibrationService() { <