eng*_*med 8 notifications android
在通知管理器中,我们使用此方法设置触发通知的时间和日期
.setWhen(System.currentTimeMillis());
Run Code Online (Sandbox Code Playgroud)
但是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();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11877 次 |
| 最近记录: |