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]: some of the user device is not in the subscription list #2041

Closed
1 task done
softsan opened this issue Apr 3, 2024 · 20 comments
Closed
1 task done

[Bug]: some of the user device is not in the subscription list #2041

softsan opened this issue Apr 3, 2024 · 20 comments
Labels
Possible Bug Maintainers need to confirm or reproduce

Comments

@softsan
Copy link

softsan commented Apr 3, 2024

What happened?

I am using OneSignal latest SDK in my Android app. We had several beta users earlier in our app. Now we did a full roll out to production. So push notifications for those few beta users are not working and there are no subscription records of those device/users in OneSignal dashboard. It works fine for other thousand of users. but not for these few users. We already asked them to clear their cache, uninstall app and freshly install the app. We double checked that they have given push permission properly.

So what could be the cause of this? Since this happens in Prod I don't have user device's OneSignal logs.

Here is some code for init, setting up external id and push permission:

Initialization of OneSignal

OneSignal.initWithContext(applicationContext, oneSignalAppId)

set external id:
OneSignal.login(userIdx)

This is how i ask permission:

CoroutineScope(Dispatchers.IO).launch {
                OneSignal.Notifications.requestPermission(true)
            }

Also enabled Push permission prompt for that user and he always received that and he always click on Allowed button. He tried on another device and its work fine there but not working on his regular android device. Most of them have a Samsung Galaxy Android 14 devices.

Can any one help on this?

Steps to reproduce?

Device is not subscribe into onesignal

What did you expect to happen?

It should subscribe and should receive push notification

OneSignal Android SDK version

5.1.7

Android version

13

Specific Android models

Samsung Galaxy s23

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jkasten2
Copy link
Member

jkasten2 commented Apr 3, 2024

@softsan is the user not shown at all on the OneSignal dashboard if you search by your external id? Or is it there but just not shown as subscribed?

Is everything working as expected with Android 12 and older devices?

You are not able to reproduce the issue on your test devices at all? Development or production builds?

Could your users have blocked onesignal.com? They can attempt to visit https://onesignal.com to ensure something on their device isn't blocking a connection to it.

@softsan
Copy link
Author

softsan commented Apr 3, 2024

@jkasten2 Thanks for quick reply. His subscription / External id is shown in OneSignal dashboard for web subscription, but not for Android subscription.

Is everything working as expected with Android 12 and older devices?
-- He tried on another device which was with Android 14 as well and its work there. for android 12 and older it works for other users.

You are not able to reproduce the issue on your test devices at all? Development or production builds?
-- Yes I am not able to reproduce in my development or prod build for my user.

Could you users have blocked onesignal.com? They can attempt to visit https://onesignal.com/ to ensure something on their device isn't blocking a connection to it.
-- No i don't think so. we shared this link with him to see if anything missing and he confirms all works well. https://documentation.onesignal.com/docs/notifications-show-successful-but-are-not-being-shown

Also previously we had android mobile app developed in Xamarin and now we completely write in android kotlin so that user was getting the push notification fine with the older app. but since now this new native android app is out in production, we unpublished the legacy one.

So this user was part of legacy app and then he enrolled for our beta testing and now our official prod app in Google play he is not getting any notifications.

We also had several other beta users but for them everything works fine for prod app.

@jkasten2
Copy link
Member

jkasten2 commented Apr 3, 2024

Thanks for the confirming all that and providing those extra details!

Do you happen to show the OneSignal Id or the Subscription Id in your app so end-users can see if they are subscribed?

  • The idea here is to rule out the device is not creating user or subscribing at all, or just not assigning the external id.

A logcat or steps to reproduce is what would really help find the root issue here. I know this would be difficult to come by, so we will also keep an eye out if we notice such an issue in our testing.

@jkasten2 jkasten2 added Possible Bug Maintainers need to confirm or reproduce Need More Information labels Apr 3, 2024
@softsan
Copy link
Author

softsan commented Apr 3, 2024

Do you happen to show the OneSignal Id or the Subscription Id in your app so end-users can see if they are subscribed?

-- i am logging those details with my backend logs. So one thing i found that OneSignalId is blank for this user in my logs. For other users , it's always there.

However i see ExternalUserId in my log.

@jkasten2
Copy link
Member

jkasten2 commented Apr 5, 2024

Thanks for all the details, I have undercovered some cases we are not handling login correctly and we will improve on this in the next release. I'll follow up here once it is released, then we can ask you to confirm if this gets fixed after that.

@softsan
Copy link
Author

softsan commented Apr 5, 2024

okay thanks. Is there any work around or solution for the time being? as our user is highly dependent on the push notification and it causes them to block from using some of my app functionality.

@jkasten2
Copy link
Member

jkasten2 commented Apr 9, 2024

@softsan do you call anything other OneSignal methods before OneSignal.login or OneSignal.logout?

  • We are trying to confirm if the issue we have identified also applies to this issue.

@softsan
Copy link
Author

softsan commented Apr 9, 2024

This is how i use OneSignal:

Initialization of OneSignal in my Application.kt

OneSignal.initWithContext(applicationContext, oneSignalAppId)

Then in my main activity i am asking permission like this

CoroutineScope(Dispatchers.IO).launch {
OneSignal.Notifications.requestPermission(true)
}

And then set external id using:
OneSignal.login(userIdx)

I have a logout functionality in my user profile page from where i call the OneSignal.Logout method.

No other OneSignal method used in my project.

@jkasten2
Copy link
Member

@softsan we released 5.1.8 which contains a fix that might be related to your issue. The symptoms match but the triggering seems different, as normally it was triggered by calling addTags followed by login. addTag is the most common User update, however any User update could trigger the issue, which was addressed in that update.

Could you try the latest version and let us know if the fixes this problem? If not could you let us know the percentage of users that seem affected by this bug?

@softsan
Copy link
Author

softsan commented Apr 15, 2024

@jkasten2 Sure thanks for the updates, i will try and see how it goes. in my build.gradle, i have the oneSignal like this:
implementation 'com.onesignal:OneSignal:[5.0.0, 5.99.99]'
So guess, it will take the 5.1.8 version as well correct? or do i explicitly define this particular version?

We used login first and then use addTags in our android app.

@jkasten2
Copy link
Member

The version range will include all 5.x.x versions, however it doesn't guarantee you will get that version, due to caching. To ensure you have the version I recommend bumping the minimum version:
implementation 'com.onesignal:OneSignal:[5.1.9, 5.99.99]'

@softsan
Copy link
Author

softsan commented Apr 17, 2024

@jkasten2 So the fix is in 5.1.9 or 5.1.8? Also released the new build of my app and it is working fine for the users who were facing that issue earlier. THANK YOU for the quick fix and updates!!

@jkasten2
Copy link
Member

jkasten2 commented Apr 18, 2024

@softsan Good to hear it sounds like things are working for you now!

So the fix is in 5.1.9 or 5.1.8?

I can't confirm 100% if your issue is fixed in those releases, as I am not completely sure if it was the same root issue. I wasn't able to reproduce an issue with the order of OneSignal methods you were calling.
However PR #2046 (released in 5.1.8) fixed a scenario where updates could stop applying in some cases when login was called. It's very possible some Users got stuck in a bad state if you ever changed the order of your OneSignal calls, or some older bug we didn't consider. The PR #2046 includes commit bc91777 which specifically helps get Users out of one known bad state, so this may have been the key for you.

@softsan let me know if you continue to have this problem and I can reopen this issue.

@softsan
Copy link
Author

softsan commented Apr 26, 2024

@jkasten2 hi again! I have one user who is still having issue getting subscribed for OneSignal. He tried login with different user on the same device but no luck. He also tried his user on another device but it didn't work either. Also he cleared cache and data, logout and uninstalled the app and fresh install. He tried it on cellular, his comp wifi and also his home wifi but still i do not see any records of him in OneSignal subscription list. So any idea why he is the only one who has such problem?

@jkasten2
Copy link
Member

@softsan thanks for reporting back! Just to confirm, so 5.1.8 and 5.1.9 fixed this issue for most users? However there is a case where one user is still stuck?

For this User, can they confirm they can access https://onesignal.com/ to ensure something on their device isn't blocking a connection to it. (I know we confirmed this before with other users, just not sure if you confirm it with this specific user)

Other than getting a logcat with VERBOSE logging (which would be a big ask for an end-user) I don't currently have any other ideas to debug the issue for a single user.

@softsan
Copy link
Author

softsan commented Apr 28, 2024

@jkasten2 Yes version 5.1.8 and 5.1.9 solved all user's issue except this one. I asked to open that url on user device mobile browser and it opens fine.

@softsan
Copy link
Author

softsan commented Apr 30, 2024

@jkasten2 Further on this, i created an in-app push prompt and it does receive on that user's device but still his device is not in the subscription list.

@jkasten2
Copy link
Member

@softsan That is a good detail to know, this means that a OneSignal User and Subscription was created for the device. This means there is a OneSignalId and a OneSignal SubscriptionId you could capture from the device. You could send these values to your own server to get them and check the subscription status on the OneSignal dashboard.

@softsan
Copy link
Author

softsan commented May 1, 2024

@jkasten2 Yeah i already logs those info in my server and i see "oneSignalId" as blank (""). ExternalId is what my userId is but "oneSignalId" is always blank for this user. Also when i searched with the ExternalId in OneSignal Dashboard, it only shows subscription for Web only(as we also use OneSignal for Web). No Mobile device is listed in that.

@softsan
Copy link
Author

softsan commented May 14, 2024

@jkasten2 Further on this, now i can see user's device in subscription list but it says "Permission not granted". However I double checked and confirmed that he has provide push notification permissions. Please help.

Screenshot 2024-05-14 at 7 54 06 PM

When i open that subscription, there is no "Externalid" and i am pretty sure I use that in my code:
Screenshot 2024-05-14 at 7 54 42 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Possible Bug Maintainers need to confirm or reproduce
Projects
None yet
Development

No branches or pull requests

2 participants