-
- 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 UnitoptIn()Opt the user into this push subscription. abstract UnitoptOut()Opt the user out of this push subscription. abstract UnitaddObserver(IPushSubscriptionObserver observer)Add an observer to this subscription, allowing the provider to be notified whenever the subscription has changed. abstract UnitremoveObserver(IPushSubscriptionObserver observer)Remove an observer from this subscription. abstract StringgetToken()The token which identifies the device/app that notifications are to be sent. abstract BooleangetOptedIn()Whether the user of this subscription is opted-in to received notifications. abstract StringgetId()The unique identifier for this subscription. -
-
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.
-
addObserver
abstract Unit addObserver(IPushSubscriptionObserver observer)
Add an observer to this subscription, allowing the provider to be notified whenever the subscription has changed.
-
removeObserver
abstract Unit removeObserver(IPushSubscriptionObserver observer)
Remove an observer from this subscription.
-
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).
-
-
-
-