Forum Xamarin.iOS

How to get InstallationId with Azure Notification Hub ?

danielparedes97danielparedes97 Member ✭✭✭

With the problem of AppCenter push retirement, I try to use again Azure Notification Hub, and I found new documentation:

https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/notification-hubs/xamarin-notification-hubs-ios-push-notification-apns-get-started.md

Now, I can send push notification to every registered devices, but I can't found the method to extract the installationId after to register the device in the AppDelegate.cs.

Can anyone help me?

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    I'm not very familiar with App Center's Push.
    But the installationId is something like deviceToken in iOS.
    APNS sends notifications to a specific device through this deviceToken. And we could bind it to custom tags in Azure.
    So that we could send notifications through this tag.

  • danielparedes97danielparedes97 Member ✭✭✭

    @LandLu I haven't any problem with the deviceToken, but to send notification to specific devices, I need the installationId.

        async Task SendRegistrationToServerAsync(NSData deviceToken)
    
                    AppStrings.tokenIOS = deviceToken.ToString();
                    var client = new MobileServiceClient(Ambassador.App.MobileServiceUrl);
                    var push = client.GetPush();
                    var installId = push.InstallationId;
                    //await push.RegisterAsync(deviceToken, templates);
    
         }
    

    This is the installationId that I say @LandLu

  • LandLuLandLu Member, Xamarin Team Xamurai

    Device token is the unique identifier for sending notifications to certain devices on iOS.
    You could bind it to a special tag.
    And then send to them on Azure portal through:

Sign In or Register to comment.