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

10 Comments

You can post comments in this post.


  • Hi, thanks for the article it helped very much..
    I want to present custom actions on Xamarin.iOS with App Center. As far as I know I should specify an action category in my “Remote Notification Payload” to do that on iOS. I could not find any sample or solution with App Center for that. Do you know how can i do it with App Center?
    Thanks in advance

    Dilâra Tezel 6 sene ago Reply


    • Hi,
      Yes you can! Firstly you have to create an APPID and key for auth. Than open your key file with a notepad and copy the authentication token and paste pushtoken input in AppCenter portal. If you have time I’ll write a article this weekend about this.

      Yiğit 6 sene ago Reply


      • I can take push notifications on iOS with App Center at present. I just want to show buttons on my remote notifications but i could not do that yet. If you can mention about it in your article i really appreciate that, thank you very much.

        Dilâra Tezel 6 sene ago Reply


  • Merhabalar,
    Bilgisayar Mühendisiyim ve bir yazılım şirketinde calısıyor um. Xamarin ile uygulamalar geliştiriyorum. Push notification da appcenter kullandım ama herkese bildirim gitmesin istiyorum. Custum device dan bahsetmişsiniz.
    Appcenter. GetInstallIdAsync() fonksiyonunu nerede kullanıcagomı anlamadım sadece yardımcı olursanız sevinirim. App. Cs de OnStart metodun altına mı yazmam gerekiyor acaba?

    Dilan TUfAN 5 sene ago Reply


    • Eger herkese notification gonderecekseniz Appcenter.GetInstallIdAsync() methodunu kullanmaniza gerek yok. Direkt AppCenter panelden veya AppCenter OpenApi’dan gonderebilirsiniz.

      Yiğit 5 sene ago Reply


  • Selam,
    Xamarin Forms ta AppCenter push notification u kullanıyorum. Android de notification geliyor ama heads-up olarak gelmesini sağlayamadım. Priority,channel vs ayarlayabileceğim bir yer bulamadım. Sizin bildiğiniz bir çözüm var mı bununla ilgili ?

    alperen babagil 5 sene ago Reply


    • Istedigin ayarlari manifest dosyasinda yapman gerekiyor.

      Yiğit 5 sene ago Reply


  • Merhabalar, burada postman üzerinden apiyi çalıştırmışsınız fakat ben mvc üzerinden bir buton aracılığı ile yapmaya çalıştığımda api status code olarak formatı yanlıs girdiğim için UnsupportedMediaType kodu dönüyor rica edersem bir fonksiyon yazabilir misiniz push api yi calıştırmak için.(Header lar ile birlikte olursa sevinirim)

    Tarık Kaya 5 sene ago Reply


  • İyi Günler Hocam
    Hocma App Center Full Ücretsiz mi yoksa 90 Günlük Kullanım suresi var?

    Abdurhman Sefer 5 sene ago Reply


Post A Reply