如果我把我的AlarmManager這樣的:安卓:AlarmManager與定義的日期
am.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), sender);
它的工作原理,並通知當我創造它推出。
但我想要的是在定義的日期和時間啓動通知,但它不起作用。 下面是我的一些代碼部分:
時,我想的通知,即可啓動的時間。
Date dateNotif = null;
dateNotif = new Date (mYear, mMonth, mDay, mHour, mMinute);
(變量開始用「m」是整數一個datepicker和TimePicker未來值可以是,爲例,2011,8,31,16,45)的AlarmManager的
設置:
am.set(AlarmManager.RTC_WAKEUP, dateNotif.getTime(), sender);
我有這個但沒有NotI位沒有失誤fication is launched ...
但似乎仿真器在幾分鐘後不再回答。
Thx尋求幫助。
時區問題?嘗試打印dateNotif.getTime()並將其與System.currentTimeMillis()進行比較,以查看您是否真的從日期中獲得所需的時間... – getekha
如果我正在生成dateNotif.getTime(),則獲得如下數字:61272948180000 並且if我打印System.currentTimeMillis(),我獲得像這樣的數字:1314804198248 – HerrM