每十分钟发送一次本地通知

时间:2019-09-16 00:44:45

标签: codenameone

我写道:

LocalNotification localNotification = new LocalNotification();
        localNotification.setId("Gratitudine");
        localNotification.setAlertTitle("Pratica della Gratitudine");
        localNotification.setAlertBody("Leggi e ripeti interiormente");
        localNotification.setAlertSound("/notification_sound_bell.mp3");
        // alert sound file name must begin with notification_sound

        Display.getInstance().scheduleLocalNotification(localNotification,
                System.currentTimeMillis() + 60 * 1000, // first notification
                LocalNotification.REPEAT_MINUTE // Whether to repeat and what frequency
        );

有效。

每十分钟重复一次通知的正确方法是什么?唯一可用的选项是:REPEAT_NONEREPEAT_MINUTEREPEAT_HOURREPEAT_DAYREPEAT_WEEK

任意分钟数(例如4或13)的相同问题。

谢谢

1 个答案:

答案 0 :(得分:1)

根据documentation,这似乎是不可能的。您只能让它每分钟重复一次。要执行您想要的操作,您可能需要在该时间间隔内设置其他通知。这意味着,如果要取消它们,则需要在用户单击通知并打开应用程序或发生其他事件时执行此操作。