0

I'm having a hard time updating the categories a user is subscribed to recibe push notifications. Here is my scenario:

Every time the app starts, I'm registering the app for notifications as suggested here by Microsoft using the user preferences stored in the local DB, if the user is not subscribed to any category, I send an empty string array:

try 
{ 
    regid = _gcm.register(_senderId);
    _hub.register(regid, categories.toArray(new String[categories.size()]));
}

After that, I can see the response back from the server without any problem:

protected void onPostExecute(Object result)
{
    String message = "No alert configured";
    if(categories.size() > 0)
    {
        message = "Configured alerts: " + categories.toString();
    }
    Toast.makeText(_context, message, Toast.LENGTH_LONG).show();
}

But even after that, the device keeps getting push notifications for categories that have been un-subscribed from.

I'm using the same Notification Hub (.net Backend) with the same app in iOS and Android, but this problem only occurs in Android.

Any ideas/suggestions?

Rama
  • 429
  • 1
  • 8
  • 14
  • This seems to be strange. Do you mind checking the registration associated with a specific device on which you are but should not be getting notifications? If you are testing it with a few devices, you can see the registrations in Visual Studio (https://azure.microsoft.com/en-us/documentation/articles/notification-hubs-diagnosing/) and confirm the tags associated with the device. It seems like the devices are still registered with the previous tags. – Mimi Xu Dec 23 '15 at 22:39
  • I've made some modifications in order to identify each device, I'm registering the devices to an extra category now, that is an GUID generated for each individual device. Doing some testing, if I register my device and later uninstall, install the app and register the device again, I can see in Visual Studio both registrations, with the old and new GUIDs, and the device will receive a push notification if I send it to any of those tags. In other words Should I call to unregister for all the categories when uninstalling the app? What can I do in this situation? – Rama Dec 30 '15 at 11:45
  • @Rama, see http://stackoverflow.com/a/31828298/594074 – Baris Akar Jan 07 '16 at 09:14

0 Answers0