-
public interface IOneSignal
-
-
Method Summary
Modifier and Type Method Description abstract BooleaninitWithContext(Context context, String appId)Initialize the OneSignal SDK. abstract Unitlogin(String externalId, String jwtBearerToken)Login to OneSignal under the user identified by the externalId provided. Unitlogin(String externalId)abstract Unitlogout()Logout the user previously logged in via login. abstract StringgetSdkVersion()The current SDK version as a string. abstract BooleangetIsInitialized()Whether the SDK has been initialized. abstract IUserManagergetUser()The user manager for accessing user-scoped management. abstract ISessionManagergetSession()The session manager for accessing session-scoped management. abstract INotificationsManagergetNotifications()The notification manager for accessing device-scoped notification management. abstract ILocationManagergetLocation()The location manager for accessing device-scoped location management. abstract IInAppMessagesManagergetInAppMessages()The In App Messaging manager for accessing device-scoped IAP management. abstract IDebugManagergetDebug()Access to debug the SDK in the event additional information is required to diagnose any SDK-related issues. abstract BooleangetConsentRequired()Determines whether a user must consent to privacy prior to their user data being sent up to OneSignal. abstract UnitsetConsentRequired(Boolean consentRequired)Determines whether a user must consent to privacy prior to their user data being sent up to OneSignal. abstract BooleangetConsentGiven()Indicates whether privacy consent has been granted. abstract UnitsetConsentGiven(Boolean consentGiven)Indicates whether privacy consent has been granted. abstract BooleangetDisableGMSMissingPrompt()Whether to disable the "GMS is missing" prompt to the user. abstract UnitsetDisableGMSMissingPrompt(Boolean disableGMSMissingPrompt)Whether to disable the "GMS is missing" prompt to the user. -
-
Method Detail
-
initWithContext
abstract Boolean initWithContext(Context context, String appId)
Initialize the OneSignal SDK. This should be called during startup of the application.
- Parameters:
context- The Android context the SDK should use.appId- The application ID the OneSignal SDK is bound to.
-
login
abstract Unit login(String externalId, String jwtBearerToken)
Login to OneSignal under the user identified by the externalId provided. The act of logging a user into the OneSignal SDK will switch the user context to that specific user.
If the externalId exists the user will be retrieved and the context set from that user information. If operations have already been performed under a guest user, they will not be applied to the now logged in user (they will be lost).
If the externalId does not exist the user will be created and the context set from the current local state. If operations have already been performed under a guest user those operations will be applied to the newly created user.
Push Notifications and In App Messaging Logging in a new user will automatically transfer push notification and in app messaging subscriptions from the current user (if there is one) to the newly logged in user. This is because both Push and IAM are owned by the device.
- Parameters:
externalId- The external ID of the user that is to be logged in.jwtBearerToken- The optional JWT bearer token generated by your backend to establish trust for the login operation.
-
logout
abstract Unit logout()
Logout the user previously logged in via login. The user property now references a new device-scoped user. A device-scoped user has no user identity that can later be retrieved, except through this device as long as the app remains installed and the app data is not cleared.
-
getSdkVersion
abstract String getSdkVersion()
The current SDK version as a string.
-
getIsInitialized
abstract Boolean getIsInitialized()
Whether the SDK has been initialized.
-
getUser
abstract IUserManager getUser()
The user manager for accessing user-scoped management.
-
getSession
abstract ISessionManager getSession()
The session manager for accessing session-scoped management.
-
getNotifications
abstract INotificationsManager getNotifications()
The notification manager for accessing device-scoped notification management.
-
getLocation
abstract ILocationManager getLocation()
The location manager for accessing device-scoped location management.
-
getInAppMessages
abstract IInAppMessagesManager getInAppMessages()
The In App Messaging manager for accessing device-scoped IAP management.
-
getDebug
abstract IDebugManager getDebug()
Access to debug the SDK in the event additional information is required to diagnose any SDK-related issues.
WARNING: This should not be used in a production setting.
-
getConsentRequired
abstract Boolean getConsentRequired()
Determines whether a user must consent to privacy prior to their user data being sent up to OneSignal. This should be set to
trueprior to the invocation of initWithContext to ensure compliance.
-
setConsentRequired
abstract Unit setConsentRequired(Boolean consentRequired)
Determines whether a user must consent to privacy prior to their user data being sent up to OneSignal. This should be set to
trueprior to the invocation of initWithContext to ensure compliance.
-
getConsentGiven
abstract Boolean getConsentGiven()
Indicates whether privacy consent has been granted. This field is only relevant when the application has opted into data privacy protections. See consentRequired.
-
setConsentGiven
abstract Unit setConsentGiven(Boolean consentGiven)
Indicates whether privacy consent has been granted. This field is only relevant when the application has opted into data privacy protections. See consentRequired.
-
getDisableGMSMissingPrompt
abstract Boolean getDisableGMSMissingPrompt()
Whether to disable the "GMS is missing" prompt to the user.
-
setDisableGMSMissingPrompt
abstract Unit setDisableGMSMissingPrompt(Boolean disableGMSMissingPrompt)
Whether to disable the "GMS is missing" prompt to the user.
-
-
-
-