Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class DesktopNotifications
- Object
- DesktopNotifications
Shows a native desktop notification now. It is a shortcut over
LocalNotification: the notification goes through the same port path,
and a click on it reaches the application’s LocalNotificationCallback
with the identifier given here. Mobile platforms answer false from
#isSupported(); LocalNotification itself still works there.
if (DesktopNotifications.isSupported()) {
DesktopNotifications.show("build-done", "Build finished", "All tests passed");
}Methods
public static void setImplementation(CodenameOneImplementation impl) | Invoked internally from Display, this method is for internal use only |
public static boolean isSupported() | True when the platform shows native desktop notifications. |
public static LocalNotification show(String id, String title, String body) | Shows a notification now. |
public static void dismiss(String id) | Removes a notification shown by #show(String, String, String). |
Inherited methods
Method details
setImplementation
public static void setImplementation(CodenameOneImplementation impl)Invoked internally from Display, this method is for internal use only
Parameters
implCodenameOneImplementation- implementation instance
isSupported
public static boolean isSupported()True when the platform shows native desktop notifications.
Returns
true on a desktop platform with notifications
show
public static LocalNotification show(String id, String title, String body)Shows a notification now.
Parameters
idString- the identifier the click callback receives
titleString- the title
bodyString- the body text
Returns
the notification that was scheduled, or null when not supported
dismiss
public static void dismiss(String id)Removes a notification shown by
#show(String, String, String).Parameters
idString- its identifier