Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ios.forceRegister option #336

Closed
wants to merge 0 commits into from

Conversation

JGreenlee
Copy link

@JGreenlee JGreenlee commented Dec 19, 2024

Description

ios.forceRegister

boolean

false

Optional. If `true` 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.

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. If true 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

On iOS, notification permissions only control user-facing notifications. Silent/invisible notifications may be received and handled in the background even when the user denies notification permissions.

However this plugin does provide a way to register for remote notifications if the user has denied UserNotifications.

How Has This Been Tested?

In my app, I observe that without forceRegister, if the user denies notification permissions prior to PushNotification.init(), neither push.on('registration', ...) nor push.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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant