0

We are trying to integrate the Baidu SDK and use it together with Azure Notification Hub in the back-end.

In Android we are using the SDK: lib-techain-release-3.5.7.4

To get the PushId of the device we use:

public class BaiduReceiver extends BroadcastReceiver {
    private static final int TYPE_REGISTRATION = 1;

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();

        if (!PUSH_ACTION.equals(action)) {
            return;
        }
        Bundle bundle = intent.getExtras();
        int type = bundle.getInt("event_type", -1);
        switch (type) {
            case TYPE_REGISTRATION:
                String uid = bundle.getString("push_uid");
                break;
            default:
                break;
        }
    }

} 

Which works. This ID can be used to send push notifications from the Baidu console. However, when integrating with Azure Notification Hub, it also requires a "Channel ID" (see https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.notificationhubs.baiduregistrationdescription?view=azure-dotnet)

How do we obtain this channel Id in Android?

Viggo Lundén
  • 748
  • 1
  • 6
  • 31

1 Answers1

0

We have the information about how to integrate with Baidu here on the Get started with Notification Hubs using Baidu in particular needing to override the onBind method of the custom PushMessageReceiver class.

  • Thanks for the reply. We have tried this method, the guide is outdated as Baidu no longer provides anything called an API key. Baidu console now only provides AppKey, SecKey and MasterSecret. – Viggo Lundén Feb 02 '22 at 23:28