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]: Incorrectly returning notification permission data until you close and open the app #1711

Open
2 of 3 tasks
MuazzezA opened this issue May 30, 2024 · 0 comments
Open
2 of 3 tasks

Comments

@MuazzezA
Copy link

What happened?

I want a notification permission when I enter the app. this permission is requested with react-native-permission.

import {requestNotifications} from 'react-native-permissions';

I am using requestNotifications.

But if I first get permission with OneSignal as below, there is no problem. when I enter the app, I can pull my data correctly.

await OneSignal.User.pushSubscription.optIn();
const notificationResult = await OneSignal.Notifications.getPermissionAsync()

When I request permission with react-native-permissions, permissionChange listener is not triggered.

 OneSignal.Notifications.addEventListener(
    'permissionChange',
    (granted: boolean) => { // some code });
    },
  );

react-native-permissions : ^3.8.0
react-native-onesignal : ^5.1.0

If this is detected when local device permissions are changed, why is it not detected when another package changes it?

Thanks

Steps to reproduce?

1. install the app
2. request permission with react-native-permission
3. Log in to the app
4. check notification permission data with OneSignal 
5. incorrect data until you exit the application

What did you expect to happen?

I would like OneSignal to know when notification permission is granted for the app. because my configurations are correct. if I close and open the app, the correct data comes through. but if I grant permission and never leave the app, the correct data never comes through. i added timeout and counter to try it out.

React Native OneSignal SDK version

5.1.0

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
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

1 participant