-
Notifications
You must be signed in to change notification settings - Fork 378
[Feedback]: Suggested tweak to documentation #1929
Description
What's on your mind?
There is a misleading section in the documentation that could be clarified to help future readers avoid the same issue.
We ran into a problem where first-time users were not enrolling correctly. The root cause turned out to be our interpretation of this section in the setup guide:
https://documentation.onesignal.com/docs/en/react-native-sdk-setup#2-initialize-sdk
// Use this method to prompt for push notifications.
// We recommend removing this method after testing and instead use In-App Messages to prompt for notification permission.
OneSignal.Notifications.requestPermission(false);
We interpreted this to mean that calling OneSignal.Notifications.requestPermission(false); was optional, and that using react-native-permissions alone would be sufficient for requesting notification permission.
However, in practice, it appears this call is critical because without it OneSignal is not properly made aware that the permission flow and enrollment have occurred. As a result, users may grant permission at the OS level, but OneSignal does not complete enrollment as expected.
A clearer version of the note could be:
// Use this method to request notification permission through OneSignal,
// so the SDK can correctly track permission state and complete enrollment.
//
// Even if you use another library to check or request OS-level notification permissions,
// you should still ensure OneSignal is informed of the permission result.
//
// For production, we recommend using In-App Messages to control when this prompt is shown.
OneSignal.Notifications.requestPermission(false);
Code of Conduct
- I agree to follow this project's Code of Conduct