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

[Bug]: Unable to determine the Notification Permission status on android via getDeviceState() #1600

Closed
2 of 3 tasks
theo-wall opened this issue Nov 10, 2023 · 2 comments
Closed
2 of 3 tasks

Comments

@theo-wall
Copy link

theo-wall commented Nov 10, 2023

What happened?

We are trying to monitor if the user has either not decided on notification permission, granted, or denied push notifications. This is possible on iOS through the notificationPermissionStatus field. But on android this field is not present and we are enable to check their permission status outside of hasNotifcationPermision: false(default)/true.

Steps to reproduce?

1. Install 4.5.1 react-native-onesignal
2. Fetch device state using `OneSignal.getDeviceState()` 
3. Check on iOS `notificationPermissionStatus` field is returned
4. Check on android `notificationPermissionStatus` field is missing

What did you expect to happen?

I am expecting notificationPermissionStatus field to be returned on iOS and Android

React Native OneSignal SDK version

Release 4.5.1

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

iOS output:
{"hasNotificationPermission": false, "isEmailSubscribed": false, "isPushDisabled": false, "isSMSSubscribed": false, "isSubscribed": false, "notificationPermissionStatus": 0, "pushToken": "<token>", "userId": "<user-id>"}

android output:
{"hasNotificationPermission": false, "isEmailSubscribed": false, "isPushDisabled": false, "isSMSSubscribed": false, "isSubscribed": false, "pushToken": "<token>", "userId": "<user-id>"}

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jennantilla
Copy link
Contributor

Hello @theo-wall thank you for your patience!

I will bring this up to the team regarding adding notificationPermissionStatus to Android. We will be moving away from the player version of our SDKs (<=4.x.x) in favor of our new major release (5.x.x).

This new version does not have getDeviceState, it does offer a new method for getting notification permission status. I'd encourage you to look at the migration guide and consider upgrading to our latest major release.

Thanks!

@theo-wall
Copy link
Author

theo-wall commented Jan 29, 2024

@jennantilla I was worried that was going to be the answer. It looks like we will have to look into updating to 5.x.x. Thanks for the response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants