Package 

Interface IPushSubscription

  • All Implemented Interfaces:
    com.onesignal.user.subscriptions.ISubscription

    
    public interface IPushSubscription
     implements ISubscription
                        

    A push subscription allows a user to receive notifications through the push channel.

    • Method Summary

      Modifier and Type Method Description
      abstract Unit optIn() Opt the user into this push subscription.
      abstract Unit optOut() Opt the user out of this push subscription.
      abstract Unit addObserver(IPushSubscriptionObserver observer) Add an observer to this subscription, allowing the provider to be notified whenever the subscription has changed.
      abstract Unit removeObserver(IPushSubscriptionObserver observer) Remove an observer from this subscription.
      abstract String getToken() The token which identifies the device/app that notifications are to be sent.
      abstract Boolean getOptedIn() Whether the user of this subscription is opted-in to received notifications.
      abstract String getId() The unique identifier for this subscription.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • optIn

         abstract Unit optIn()

        Opt the user into this push subscription. If the application does not have permission, the user will be prompted by Android to permit push permissions. If the user has granted app permission, the user will be able to receive push notification. If the user rejects app permission, the user will only be able to receive push notifications once the app permission has been granted.

      • optOut

         abstract Unit optOut()

        Opt the user out of this push subscription. The user will no longer received push notifications, although the app permission state will not be changed.

      • getToken

         abstract String getToken()

        The token which identifies the device/app that notifications are to be sent. May be an empty string, indicating the push token has not yet been retrieved.

      • getOptedIn

         abstract Boolean getOptedIn()

        Whether the user of this subscription is opted-in to received notifications. When true, the user is able to receive notifications through this subscription. Otherwise, the user will not receive notifications through this subscription (even when the user has granted app permission).

      • getId

         abstract String getId()

        The unique identifier for this subscription. This will be an empty string until the subscription has been successfully created on the backend and assigned an ID. Use addChangeHandler to be notified when the id has been successfully assigned.