我有兩次,每天這些時間是前一天的,例如 reminder1-DAY1不同的通知:5:30 reminder1-DAY2:5:35我每天需要觸發不同的時間
我從JSON對象的互聯網獲取時間... 我需要的是當系統時鐘到達提醒的時間觸發的通知,我已經做是含ALRM經理,是以一個actvity這個提醒的時間和廣播接收器會創建一個通知; 但這並不是一個很好的解決方案,因爲我不能做一個重複報警,因爲每一天我有不同的時間...... 我不能呼籲廣播接收器相同的報警方法,因爲我需要創建全活動再次採取所有的變量,因爲他們不會再在那裏了...
所以有辦法創建一個服務,即使在手機重新啓動它將繼續其工作和會比較系統的時間和提醒的時間,並在兩個時間相等時觸發通知,或者是否有另一種解決方案? 謝謝。
編輯
public void scheduleAlarm()
{
Long time=calendar.getTimeInMillis()+5*60*1000;
//other lines to get the real time..
Intent intentAlarm = new Intent(this, TimeAlarm.class);
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP,time, PendingIntent.getBroadcast(this,1, intentAlarm, PendingIntent.FLAG_UPDATE_CURRENT));
}
請你能不能給我更多的信息或鏈接跟隨..謝謝。 – User
對於['的Android Services'](http://developer.android.com/guide/components/services.html#ExtendingService)的阱的配置和用於鏈接涉及註冊和註銷['AlarmManager'](HTTP的:// stackoverflow.com/questions/4459058/alarm-manager-example) – xhamr
會看到的感謝。 – User