【发布时间】:2021-02-24 21:43:50
【问题描述】:
我想在我的应用程序中使用本地通知,我想每年为用户发送生日消息。
1)我如何在特定日期和时间安排通知?这里使用 Display.getInstance().scheduleLocalNotification,我可以设置时间来安排通知,但我如何设置具体的日期和时间?
2) 有 REPEAT_NONE、分钟、小时、日、周,但是否也有 Repeat_Year?
3) localNotification 的覆盖方法是否有任何特定用途,即。本地通知接收()?我有 System.out 和 Dialog.show 方法,但是当通知出现时两者都不显示。
public class LocalNotificationTest implements LocalNotificationCallback {
public void noti(){
LocalNotification n = new LocalNotification();
n.setAlertBody("body");
n.setAlertTitle("title");
n.setId("id");
Display.getInstance().scheduleLocalNotification(n, System.currentTimeMillis() + 10 * 1000, LocalNotification.REPEAT_NONE);
}
@Override
public void localNotificationReceived(String notificationId) {
System.out.println("Received local notification "+notificationId+" in callback localNotificationReceived");
Dialog.show("noti", "checking notifications", "ok", null);
}
}
【问题讨论】:
标签: codenameone