You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Form hi = new Form("Hi World");
Button button = new Button("Schedule notification");
button.addActionListener(event -> {
com.codename1.notifications.LocalNotification ln = new com.codename1.notifications.LocalNotification();
ln.setId("LnMessage");
ln.setAlertTitle("Welcome");
ln.setAlertBody("Thanks for arriving!");
ln.setBadgeNumber(1);
Date date = new Date();
date.setTime(date.getTime() + 4000);
Display.getInstance().scheduleLocalNotification(ln, date.getTime(), com.codename1.notifications.LocalNotification.REPEAT_NONE);
});
hi.add(button);
hi.show();
This triggers a notification 4 seconds after the button is clicked. When I run this on my Android device, it works fine if the app is in foreground or if it is in recent apps. However, when I remove it from recent apps, the local notification crashes.
The text was updated successfully, but these errors were encountered:
14:03:34 E AndroidRuntime : FATAL EXCEPTION: main
14:03:34 E AndroidRuntime : Process: com.recipes.local, PID: 24390
14:03:34 E AndroidRuntime : java.lang.RuntimeException: Unable to start receiver com.codename1.impl.android.LocalNotificationPublisher: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
14:03:34 E AndroidRuntime : at android.app.ActivityThread.handleReceiver(ActivityThread.java:2732)
14:03:34 E AndroidRuntime : at android.app.ActivityThread.-wrap14(ActivityThread.java)
14:03:34 E AndroidRuntime : at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
14:03:34 E AndroidRuntime : at android.os.Handler.dispatchMessage(Handler.java:102)
14:03:34 E AndroidRuntime : at android.os.Looper.loop(Looper.java:148)
14:03:34 E AndroidRuntime : at android.app.ActivityThread.main(ActivityThread.java:5422)
14:03:34 E AndroidRuntime : at java.lang.reflect.Method.invoke(Native Method)
14:03:34 E AndroidRuntime : at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
14:03:34 E AndroidRuntime : at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
14:03:34 E AndroidRuntime : Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
14:03:34 E AndroidRuntime : at com.codename1.impl.android.LocalNotificationPublisher.createAndroidNotification(LocalNotificationPublisher.java:90)
14:03:34 E AndroidRuntime : at com.codename1.impl.android.LocalNotificationPublisher.onReceive(LocalNotificationPublisher.java:76)
14:03:34 E AndroidRuntime : at android.app.ActivityThread.handleReceiver(ActivityThread.java:2725)
14:03:34 E AndroidRuntime : ... 8 more
14:03:34 E GMPM : getGoogleAppId failed with status: 10
14:03:34 E GMPM : Uploading is not possible. App measurement disabled
14:03:50 E QCALOG : [MessageQ] ProcessNewMessage: [LOWI-SERVER] unknown deliver target [OS-Agent]
Simple app to reproduce:
This triggers a notification 4 seconds after the button is clicked. When I run this on my Android device, it works fine if the app is in foreground or if it is in recent apps. However, when I remove it from recent apps, the local notification crashes.
The text was updated successfully, but these errors were encountered: