Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
ios.forceRegister
boolean
false
On iOS, notification permissions only control user-facing notifications. Silent/invisible notifications can be received and handled in the background even when the user denies notification permissions.
When forceRegister is true, registerForRemoteNotifications will be called on init even if requestAuthorizationWithOptions comes back with granted=FALSE.
|
ios.forceRegister
|boolean
|false
| Optional. Iftrue
the app will register for remote notifications, even if the user has denied notification permissions. On iOS, notification permissions only control user-facing notifications – background pushes can still be received. |Related Issue
#335
Motivation and Context
How Has This Been Tested?
In my app, I observe that without
forceRegister
, if the user denies notification permissions prior toPushNotification.init()
, neitherpush.on('registration', ...)
norpush.on('error', ...)
are invoked.When
forceRegister
= true, and the same scenario,push.on('registration', ...)
is called and an APNS token is established.When
forceRegister
= false or not defined, the behavior is the same as before.Screenshots (if appropriate):
Types of changes
Checklist:
I have added tests to cover my changes.All new and existing tests passed.