public long getTimeDifference(){
Date current = new Date();
Date future = new Date();
future.setHours(time.getCurrentHour());
future.setMinutes(time.getCurrentMinute());
if((future.getTime() - current.getTime()) < 0){
future.setDate(future.getDate()+1);
}
return future.getTime() - current.getTime();
}
public void setAlarm(long time){
Intent intent = new Intent(Volume.this,RadioService.class);
PendingIntent pendingIntent = pendingIntent = PendingIntent.getService(
Volume.this, 0, intent, 0);
String sd = "time is:" + time;
Log.e("time dif", sd);
alarm.set(AlarmManager.RTC_WAKEUP, time, pendingIntent);
}
答案 0 :(得分:1)
RTC_WAKEUP
想要UTC的实际时间,而不是差异。