Package 

Interface IOneSignal

    • 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.

      • getUser

         abstract IUserManager getUser()

        The user manager for accessing user-scoped 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 true prior 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 true prior 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.