5
時間和日期,我們用這個方法來設置時間和日期解僱通知如何設置通知
.setWhen(System.currentTimeMillis());
通知經理,但System.currentTimeMillis()
坐回設備當前的時間,但我想補充指定時間喜歡(星期五15:00)
我該怎麼做?如何設置這個時間以毫秒爲單位,並在.setWhen
感謝加載它提前
這個代碼我使用
Notification.Builder builder =
new Notification.Builder(MyActivity.this);
builder.setSmallIcon(R.drawable.ic_launcher)
.setTicker(「Notification」)
.setWhen(System.currentTimeMillis())
.setDefaults(Notification.DEFAULT_SOUND |
Notification.DEFAULT_VIBRATE)
.setSound(
RingtoneManager.getDefaultUri(
RingtoneManager.TYPE_NOTIFICATION))
.setVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 })
.setLights(Color.RED, 0, 1);
Notification notification = builder.getNotification();
setWhen(長時間)不用於設置日期和時間來觸發通知。請參閱文檔: http://developer.android.com/reference/android/app/Notification.Builder.html#setWhen(long) – Deimos 2013-08-05 11:12:58