Unsubscribing from Google Cloud Messaging Client in an Android App

I am developing an Android application in xamarin using GCM (Google Cloud Messaging) and Azure Notification Hub.

The problem is this: I do not know how to unsubscribe from previous tags. Even when I delete the installation again, the application continues to receive notifications for every tag that I wrote earlier.

meybe I need to implement a function:

protected override void OnUnRegistered(Context context, string registrationId)
{
     throw new NotImplementedException();
}
+4
source share
2 answers

I think you need to unregister in the Azure Notification Hub.

protected override void OnUnRegistered(Context context, string registrationId)
{
    if (hub != null)
        hub.Unregister();
}

where hubis the same NotificationHubthat you used inOnRegistered

+2

unregister() GoogleCloudMessaging, GCM.

protected override void OnUnRegistered(Context context, string registrationId){
     //Run on background
     GoogleCloudMessaging.getInstance(context).unregister();
}

public void unregister()

. unregister() . - . ( -) . , , . , . , , GCM , . IOException, .

0

Source: https://habr.com/ru/post/1616482/


All Articles