2

I need to use Baidu Push notification in my app. But it is very difficult to find the documentaion on it to know about the difference from GCM. Is there any document or site available to know the exact difference between GCM and Baidu Pushnotification ? Also which is better to use in terms of performance ?

Ravi Kumar
  • 339
  • 2
  • 11
  • 24

1 Answers1

6

In terms of functionality there is no difference between GCM and Baidu Push notifications.

Baidu can be considered as an alternative for your GCM in china, as most of the Google services are blocked in China. Since, GCM is a part of Google-play-services package, it is also blocked in China.

Documentation: For this you would need to use google translate on pages specified below (ie. once the page is loaded, right click and select translate to english) :

Step 1: Create a new Developer account on Baidu platform. (If you do not possess a Mainland China Phone number, it is not possible to create a Baidu developer account)

Step 2: Download the Android SDK for Baidu push services from the below address: http://push.baidu.com/sdk/push_client_sdk_for_android

Step 3: Integrate the above downloaded SDK into your app like you would do for any SDK that has *.so (Shared Object file libraries) files. That is you need to put them in your jniLibs/

Step 4: Then like in GCM console you create a new application with its application Id/ Package Name, in baidu as well you need to do the same. That is goto the below URL (Make sure you are logged in): http://push.baidu.com/console/app On this console page Create a new application (Use Google translate plugin on Chrome).

Step 5: Once a new application is created, your application will be assigned a API Key and a Secret Key. Inorder to receive Push notifications, you need to used the API Key as specified in the below page: http://push.baidu.com/doc/android/api All the development steps are specified in the above link. Just translate the page to follow the same.

Step 6: In GCM you can either send a push notification using the GCM console or you can use your own server to send a GCM notification to the device. Its the same on Baidu as well. Details are in the above link.

Performance:

From my personal experience, i feel GCM is really good. I always get the Notification immediately. However, in case of Baidu, it does take sometime for the notification to arrive(most of the times).

Also there is a Demo example which comes along with the SDK. You can keep that as a reference while developing the app.

Zax
  • 2,870
  • 7
  • 52
  • 76
  • I am implementing Baidu Push into an application of mine too, but I am experiencing issues with receiving them. some notifications just won't be delivered to the device. I am located in Europe btw. I contacted Baidu multiple times already, but they just won't respond. I think, that the Push receiving intent is canceled by the Phone at some point. – David Gölzhäuser Aug 27 '19 at 13:07
  • @DavidGölzhäuser Use the latest version of their push Jar library. Also, if your app isn't started atleast once, you will not receive notifications. You need to write your own workaround to handle this scenario. I used to initialize the push received on BOOT_COMPLETED broadcast receiver. – Zax Aug 27 '19 at 14:35
  • Could you please take a look at this question: https://stackoverflow.com/questions/55137626/delayed-baidu-push-notification – David Gölzhäuser Aug 29 '19 at 09:35