Giter Site home page Giter Site logo

Comments (3)

Martinocom avatar Martinocom commented on September 28, 2024 1

If your code is more or less exactly the same as you posted, there is a limitation in the doc saying:

Any User namespace calls must be invoked after initialization. Example: OneSignal.User.addTag("tag", "2")

Maybe you should initialize the SDK, then inside a provider subscribe into permissionChange event and wait for confirmation and ONLY THEN ask for the ID. This justified delay may help in your case, but if you don't want to "justify", you can try if a setTimeout works.

from react-native-onesignal.

jennantilla avatar jennantilla commented on September 28, 2024 1

Hello there! In 5.1.0 we updated the Push Subscription property getters to be async so that the value is always correct. Please upgrade to this version and let us know if you are still having any issues.

Thanks!

from react-native-onesignal.

johannessachse avatar johannessachse commented on September 28, 2024

We also have a similar issue while using version 5.0.5. I can not reproduce this by myself, but I get corresponding Sentry-Exceptions.

  1. Initialize OneSignal during app start
        OneSignal.Debug.setLogLevel(LogLevel.Verbose);
        OneSignal.initialize(appId);
        OneSignalHelper.requestPermission();
        OneSignalHelper.addEventListener(...)
  1. Get the subscription ID. To make sure that OneSignal is correctly initialized, we do a 5-times retry with 2 seconds timeout each. Additionally, the user needs to fill in a login form before this function is executed. That means our last attempt to retrieve the subscription ID is typically 12-20 seconds after app start.
OneSignal.User.pushSubscription.getPushSubscriptionId()

Nevertheless, for some users we don't get a subscription ID. This happens on Android (13, 14) as well as on iOS (15.8 up to 17.4)

from react-native-onesignal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.