You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm facing an issue on Android where the OneSignal PlayerID is always null during the initial startup of the application (i.e., the first time after installation). As a result, I am unable to save the PlayerID to my database until the second launch of the app.
Steps to Reproduce:
Install the application on an Android device.
Launch the application.
Attempt to retrieve and save the OneSignal PlayerID. (OneSignal.getDeviceState())
Actual Behavior:
The OneSignal PlayerID is null on the initial launch, which prevents its storage in the database.
Expected Behavior:
The OneSignal PlayerID should be available during the initial launch of the application, allowing it to be saved in the database right away.
I'm looking for guidance on how to handle this situation. What can I do to ensure that the PlayerID is available and savable on the first launch? Any suggestions or best practices would be highly appreciated.
Thank you in advance for your help!
Environment:
OneSignal SDK version: 4.5.1
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Hi @maoryadin, thanks for reaching out with your question.
If getDeviceState() is called too early it will be null or not available. There is a server call to register the device and get a playerID.
You can use the addSubscriptionObserver method to get a playerID from OneSignal when a notification subscription property changes. Does this fulfill your needs?
Hi @maoryadin, thanks for reaching out with your question.
If getDeviceState() is called too early it will be null or not available. There is a server call to register the device and get a playerID.
You can use the addSubscriptionObserver method to get a playerID from OneSignal when a notification subscription property changes. Does this fulfill your needs?
Thanks!
Does the addSubscriptionObserver should be defined before OneSignal.SetAppId?
Because i think if it will be defined after, it will not be triggered..
How can we help?
Hello everyone,
I'm facing an issue on Android where the OneSignal PlayerID is always null during the initial startup of the application (i.e., the first time after installation). As a result, I am unable to save the PlayerID to my database until the second launch of the app.
Steps to Reproduce:
Install the application on an Android device.
Launch the application.
Attempt to retrieve and save the OneSignal PlayerID. (OneSignal.getDeviceState())
Actual Behavior:
The OneSignal PlayerID is null on the initial launch, which prevents its storage in the database.
Expected Behavior:
The OneSignal PlayerID should be available during the initial launch of the application, allowing it to be saved in the database right away.
I'm looking for guidance on how to handle this situation. What can I do to ensure that the PlayerID is available and savable on the first launch? Any suggestions or best practices would be highly appreciated.
Thank you in advance for your help!
Environment:
OneSignal SDK version: 4.5.1
Code of Conduct
The text was updated successfully, but these errors were encountered: