Push Registration and Privacy

📘

By default your app will prompt the user to allow push notifications and register with OneSignal on the first launch of the app. You may optionally delay the prompt, and trigger it manually via Javascript.

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.

Explicitly grant OneSignal permission to transmit device data

By default your app will send device data to OneSignal to facilitate push notifications. 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.

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

️GoNative JavaScript Bridge

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

gonative.onesignal.userPrivacyConsent.grant();
<a onclick="gonative.onesignal.userPrivacyConsent.grant()">Prompt for Push Notification Privacy Consent</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>

🚧

Registration vs Consent

When a device registers with OneSignal it will immediately begin receiving push notifications and these can not be stopped within the app. Revoking OneSignal consent stops your app from sending device info to OneSignal but does not prevent receiving push notifications.

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