Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public final class DesktopNotifications

  1. Object
  2. 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

impl CodenameOneImplementation
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

id String
the identifier the click callback receives
title String
the title
body String
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

id String
its identifier