如何安排通知到特定时间?

时间:2016-03-16 09:08:52

标签: java android push-notification alarmmanager reminders

我使用下面的代码来安排指定延迟的通知。有人可以告诉我我应该对代码做出哪些更改,以便将通知安排到指定的时间,例如上午9:15。

    PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    int delay=10000;
    long futureInMillis = SystemClock.elapsedRealtime() + delay;
    AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
    alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, futureInMillis, pendingIntent);

0 个答案:

没有答案
相关问题