AppCenter Push Notification – Part 2

In this article, we’ll look at sending device-specific notifications with AppCenter open api.

If you want to integrate AppCenter utilities into your back-end system, the appcenter open api layer will help you.

Firstly you need to get APIToken for open api authorization. You can learn by following the steps on the site

All methods are available under notification category and we’ll use push send method

 

I will use the postman for test

Our sample url is https://api.appcenter.ms/v0.1/apps/{owner_name}/{app_name}/push/notifications we need to fill owner_name and app_name fields

You can find your owner_name and app_name in your project url.

owner_name : Yigit

app_name : VSAppCenterPushNotification

This url should be : https://api.appcenter.ms/v0.1/apps/Yigit/VSAppCenterPushNotification/push/notifications

Now we can send notification all devices or device-specific

Let’s try!

We need to set X-API-Token in postman

You can set additionalProp1, additionalProp2 and additionalProp1 if you want.

Let’s try to how to send device-specific notification

We have to fill notification_target in request body

Firstly we need to get device id. We can get the device id using GetInstallIdAsync method.

var dId = await AppCenter.GetInstallIdAsync();

Our request should be;

You can find installed Id and more information in this site

Let’s check appcenter

You can send push notification to an audience

“notification_target” : { “type” : “audiences_target”, “audiences” : [“a-1”, “a-2”] }

Yiğit

Xamarin Developer, Consultant & Architect. Community Leader and Director of Xamarin Türkiye

Post A Reply