Skip to content

[question]: Why does the method OneSignal.initialize() not return a Future? #979

@MarcelGalster

Description

@MarcelGalster

How can we help?

In the first step of my code, I initialize OneSignal with the function OneSignal.initialize().
In the second step, I want to use the OneSignal.Notifications.permission field to query whether the system permission are still available.
However, as the initialize() function is not asynchronous, the field OneSignal.Notifications.permission returns an incorrect result.
The same happens for other fields such as OneSignal.User.pushSubscription.optedIn.
If I wait 200ms after initialization, the fields return the correct results.

So shouldn't the initialize function be asynchronous and wait for all fields to be initialized? Is this possible in a future release?

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions