Class NotificationPermissionResult

java.lang.Object
com.codename1.notifications.NotificationPermissionResult

public class NotificationPermissionResult extends Object

The result of a notification permission request delivered to a NotificationPermissionCallback. It exposes whether the user granted permission and the granular authorization level that was returned by the platform.

The authorization levels mirror the iOS UNAuthorizationStatus values. On platforms that only have a binary granted/denied model (such as Android) the level will be either #AUTH_AUTHORIZED or #AUTH_DENIED.

See also
  • NotificationPermissionCallback

  • NotificationPermissionRequest

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The user granted full notification permission.
    static final int
    The user explicitly denied notification permission.
    static final int
    Notifications were authorized for a limited amount of time (App Clip style).
    static final int
    The user has not yet made a choice regarding notification permission.
    static final int
    Notifications were authorized provisionally (delivered quietly without an explicit prompt).
  • Constructor Summary

    Constructors
    Constructor
    Description
    NotificationPermissionResult(boolean granted, int authorizationLevel)
    Creates a new result.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the granular authorization level, one of the AUTH_ constants.
    boolean
    Returns true if notifications are permitted, including provisional authorization.
    boolean
    Returns true if the authorization is provisional (quiet) rather than explicit.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • AUTH_NOT_DETERMINED

      public static final int AUTH_NOT_DETERMINED
      The user has not yet made a choice regarding notification permission.
      See Also:
    • AUTH_DENIED

      public static final int AUTH_DENIED
      The user explicitly denied notification permission.
      See Also:
    • AUTH_AUTHORIZED

      public static final int AUTH_AUTHORIZED
      The user granted full notification permission.
      See Also:
    • AUTH_PROVISIONAL

      public static final int AUTH_PROVISIONAL
      Notifications were authorized provisionally (delivered quietly without an explicit prompt). Applies to iOS provisional authorization.
      See Also:
    • AUTH_EPHEMERAL

      public static final int AUTH_EPHEMERAL
      Notifications were authorized for a limited amount of time (App Clip style).
      See Also:
  • Constructor Details

    • NotificationPermissionResult

      public NotificationPermissionResult(boolean granted, int authorizationLevel)

      Creates a new result.

      Parameters
      • granted: true if notifications are allowed (full or provisional)

      • authorizationLevel: one of the AUTH_ constants

  • Method Details

    • isGranted

      public boolean isGranted()

      Returns true if notifications are permitted, including provisional authorization.

      Returns

      true if notifications can be posted

    • getAuthorizationLevel

      public int getAuthorizationLevel()

      Returns the granular authorization level, one of the AUTH_ constants.

      Returns

      the authorization level

    • isProvisional

      public boolean isProvisional()

      Returns true if the authorization is provisional (quiet) rather than explicit.

      Returns

      true if the authorization level is #AUTH_PROVISIONAL