代号不显示本地通知

时间:2019-05-02 23:14:44

标签: android codenameone

我想使用codenameone显示本地通知。

我已导入本地通知,但未显示任何错误;但是,通知没有弹出!

这是代码:

public void start() {
    LocalNotification n = new LocalNotification();
    n.setId("demo-notification");
    n.setAlertBody("It's time to take a break and look at me");
    n.setAlertTitle("Break Time!");
    n.setAlertSound("/notification_sound_beep-01a.mp3");
    // alert sound file name must begin with notification_sound

    Display.getInstance().scheduleLocalNotification(
            n,
            System.currentTimeMillis() + 10 * 1000, // fire date/time
            LocalNotification.REPEAT_MINUTE  // Whether to repeat and what frequency
    );
    Form hi = new Form();
    hi.show();
}

0 个答案:

没有答案