Open GokhanArik opened 8 years ago
Is there a chance that somehow the same device token gets re-registered over and over again? Then, indeed, if you just remove one registrations, the others will still stay there.
There's a REST API (corresponds to getRegistrationsByChannel SDK method) to get all registrations by token. You could use that to see whether there're registrations associated with the device left.
I can look at registrations using Visual Studio and delete duplicate ones also. However, for an app that is in production that won't solve the problem. I don't want to write a script to check and remove duplicate entries. Azure SDK should handle that. What do you think?
I don't want to write a script to check and remove duplicate entries. Azure SDK should handle that.
Totally agree with that. That's why I was trying to understand why are there duplicates and suggested that maybe the same device token keeps re-registered and gets different registration ids. Are you sure that you only register a single device only once?
No, as I said a device gets registered multiple times. Here is a possible scenario,
Now the user will have two registration IDs for the same device. In production, it might be an edge case. However, when we are testing we keep installing/uninstalling the app and it slows down our testing process.
I think part of the problem is that Google Cloud Messaging is always assigning the same id for the device, so it gets registered multiple times. In my opinion, Azure shouldn't allow duplicate entries for the same PNS handle or make it optional in Notification Hub Settings.
@nikitag-ms Is there any solution to that?
Can you store the original registrationId in the local storage that can persist re-installation and then call CreateOrUpdateRegistration?
That's what I'm planning to do
I am in the same situation.
Works well
Works wrong
After receive a 401 (unauthorized) I'm planning to do a unregisterall call, but first task that method do is to refresh pnshandle that gives another 401 so no pnshandle is removed.
I guess the problem is in refreshing registrations. https://github.com/Azure/azure-notificationhubs/blob/master/Android/notification-hubs-sdk/src/main/java/com/microsoft/windowsazure/messaging/NotificationHub.java#L259
What means exactly 401? I was planning to use directly REST API, but if this can be solved would be great
someone can solve the problem ? i have the same issue 👎
In .NET Framework. When adding new registration, you can search for all existing ones that uses the same GCM handle
var oldRegistrations = await hub.GetRegistrationsByChannelAsync(registration.Handle, 10);
This issue seems to still be valid. The number of registered devices keeps increasing even if I'm only testing the sdk with one device (installing/uninstalling a lot) and can't see a way to see which device are registered from the azure portal, only a number refreshing daily which is pretty useless in this case trying to debug which devices are still registered and receiving the notifications.
Hi,
There is a common problem I saw around. Sometimes a device is registered multiple times. When you unregister it doesn't unregister all registrationIDs associated with the device. It just deletes one.
The scenario to recreate the issue is that if the user uninstalls our app, we won't be able to unregister their device. When they install again they will be registered twice. If we unregister latest registrationId, the first one still be in the hub.