Push Registration and Privacy Consent

📘

By default your app will automatically prompt the user to allow push notifications on the first launch of the app. You may optionally delay the push notification prompt and trigger manually via Javascript. By default your app will automatically transmit data to OneSignal including obtaining a `oneSignalUserId`. To facilitate privacy policy compliance you may optionally defer communication with OneSignal until consent is provided by the user.

Delaying Push Notification Registration on iOS

To disable automatic registration edit the oneSignal configuration object in appConfig.json and specify "autoRegister": false as follows:

"oneSignal": {
    "active": true,
    "applicationId": "XXXXXXXX",
    "autoRegister": false
}

↔️GoNative JavaScript Bridge

To trigger the prompt for push notification registration run the following command:

gonative.onesignal.register();
<a onclick="gonative.onesignal.register()">Register for Push Notifications</a>

Note: There is no user prompt in Android and thus this functionality is only applicable for iOS.

🚧

Initialization vs Push Registration

Even if you delay push registration the device will still initialize with OneSignal and obtain a oneSignalUserId. To defer initialization and communication with OneSignal refer to the following section on privacy.

Explicitly grant OneSignal permission to transmit device data

By default your app will automatically send device data to OneSignal to initialize. This includes obtaining a oneSignalUserId which can be used to associate the device and user. To facilitate GDPR compliance you may optionally defer sending data until consent is received from the user.

To request explicit consent from the user before any device data is sent to OneSignal edit the oneSignal configuration object in appConfig.json and specify "requiresUserPrivacyConsent": true and then use the GoNative JavaScript Bridge to grant and revoke consent. Once consent has been granted the device will initialize with OneSignal and a oneSignalUserId will be assigned and sent to the device.

"oneSignal": {
    "active": true,
    "applicationId": "XXXXXXXX",
    "requiresUserPrivacyConsent": true
}

↔️GoNative JavaScript Bridge

To grant privacy consent run the following command. If autoRegister is not set to false (see above) the push notification prompt will also be displayed to the user.

gonative.onesignal.userPrivacyConsent.grant();
<a onclick="gonative.onesignal.userPrivacyConsent.grant()">Consent to Push Notification Privacy Policy</a>

To revoke push notification consent run the following command:

gonative.onesignal.userPrivacyConsent.revoke()
<a onclick="gonative.onesignal.userPrivacyConsent.revoke()">Revoke Push Notification Privacy Consent</a>

🚧

Revoking Privacy Consent

Revoking OneSignal privacy consent stops your app from sending data to OneSignal but does not prevent receiving push notifications.

To control which users receive which notifications consider using Tags within OneSignal