Use Baidu Push Service in Xamarin.Android

Firebase Cloud Messaging is a very good push notification service for most Android app, except it doesn’t work in China. Google services are blocked over there.

Baidu Cloud Push is one of the push notification service that can work in China. They have iOS/Android client SDK, Java/PHP based server SDK, REST API, and is intergrated into Amazon SNS & Microsoft Azure’s Notification Hub service.

I’m going to show you how do you integrate Baidu Cloud Push into Xamarin.Android project, and use it with Amazon SNS/Azure Notification Hub.


What you’ll need.


1. Download ‘Baidu.Android.PushService’ nuget

  1. Download this Nuget. It’s a Xamarin.Android binding library for Baidu Push Service Android native SDK.
  2. Complete the additional setup instruction

2. Create the required permissions & registration in App Manifest

3. Implement the push notification receiver

And initialize the class in your MainActivity OnCreate function.

4. You’re done!

Upon the app launch, your device will be registered with Baidu Cloud Push (generating a unique UserId, channelId) and a token/regId from your choice of push notification platform.

You can use those ID to do a push notificaiton to your device now.


The full project repository can be found here