[Bug]: Some Android devices doesn't get OneSignalId and SubscriptionId
What happened?
I installed latest version now 5.2.13 and i'll try but i had 5.2.8
These two lines, only on some random android, doesn't return a value or it's empty:
const oneSignalId = await OneSignal.User.getOnesignalId(); const subscriptionId = await OneSignal.User.pushSubscription.getIdAsync();
Here's a list of some devices i checked: OPPO A78 A23 Samsung A52 realme 14 Pro 5G
Steps to reproduce?
1. Setup OneSignal app id
2. Try to get id
What did you expect to happen?
Return OnesignalID and SubscriptionId
React Native OneSignal SDK version
5.2.8
Which platform(s) are affected?
- [ ] iOS
- [x] Android
Relevant log output
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Hi @Tebrynn, when are you checking for getOnesignalId() and pushSubscription.getIdAsync()?
If you call it too early, these values are not available. The await is necessary for the library to cross the bridge to ask native Android and iOS values, not for awaiting the existence of the value.
Well, i have more than 15k users. I got this error only on Android and on few devices. I even tried to wait more than 20 seconds on those devices and still empty. List of some known devices with this bug: OPPO A78 S22 M2102j20SG?? A26
I'd like to clarify that I don’t think the issue is with the prompt, since our customers are allowing push notifications (I have a video as proof). The problem seems to be related to the initialization. I stored getOneSignalId in a state and tried reading that value again every 10 seconds, but it seems that no user is being created for those devices. I also had them uninstall and reinstall the app multiple times
but it seems that no user is being created for those devices. I also had them uninstall and reinstall the app multiple times
Hi @Tebrynn if you are not getting a value from getOneSignalId after waiting a while, the user was not able to be created. The OneSignal ID is generated by the server and returned to the SDK. If you are able to have logs, we can see what is going wrong. Also, you are experiencing that uninstall and reinstall does not work? On a new app install, no user is being created?
but it seems that no user is being created for those devices. I also had them uninstall and reinstall the app multiple times
Hi @Tebrynn if you are not getting a value from getOneSignalId after waiting a while, the user was not able to be created. The OneSignal ID is generated by the server and returned to the SDK. If you are able to have logs, we can see what is going wrong. Also, you are experiencing that uninstall and reinstall does not work? On a new app install, no user is being created?
I can confirm it happens on new app install and reinstall on those devices
It’s hard to get a log in production. I cannot even reproduce it on emulators and on my real devices. Do you have any idea how to log it? Do you think i should force user creation by calling OneSignal.login(tmpid)?
+1
"expo": "^53.0.20",
"react-native": "0.79.5",
"react-native-onesignal": "^5.2.13"
I even tried login and nothing changed. Error still persists and i have another phone, Xiaomi POCO M21020SG Android 33.
I can confirm it happens on new app install and reinstall on those devices
I even tried login and nothing changed. Error still persists and i have another phone, Xiaomi POCO M21020SG Android 33.
@Tebrynn If this error is happening for you, do you have logs?
Calling OneSignal.login(tmpid) will not resolve this issue.
I don't have logs it is on production and i don't know how to log and what to log. I tried login using prefix "temp_" and device id but it fails
I tried login multiple times but it didn’t work. I know it happens on few devices but i’d like to solve this problem
+one OneSignal.login doens't set externalID It's super critical for my users @Tebrynn Have u found something?
Hi @Tebrynn it's hard to see what is happening without any logs, you mention your device Xiaomi POCO M21020SG Android 33, are you able to test locally? You could also conditionally turn on verbose logging with OneSignal.Debug.setLogLevel(LogLevel.Verbose) for certain installations.
Well, i have more than 15k users. I got this error only on Android and on few devices.
If it happens rarely, we won't be able to figure out the root cause until we can get some data on what is happening.
I tried login multiple times but it didn’t work.
If there is no onesignal ID and no push subscription ID on a new install, calling login will not fix it. These initial IDs need to be generated first.
Ok, I enabled the debugAlert. Here are two messages when forcing create user:
[main] ApplicationService.onActivityResumed(1, APP_OPEN): bundlename.MainActivity
[main] InfluenceManager.attemptSessionUpgrade: Trackers after update attempt: [ChannelTracker{tag=notification_id,influenceType=UNATTRIBUTED,indirectIds=null,directId=null},ChannelTracker{tag=iam_id,influenceType=UNATTRIBUTED, indirectIds=null, directId=null}]
[main] ChannelTracker.getLastReceivedIds:lastChannelObjectReceived: []
Another device without OnesignalId is Honor 400 lite. App uninstalled and installed, same problem.