0

我们正在尝试集成百度 SDK 并将其与后端的 Azure Notification Hub 一起使用。

在 Android 中,我们使用 SDK:lib-techain-release-3.5.7.4

要获取我们使用的设备的 PushId:

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;
        }
    }

} 

哪个有效。此 ID 可用于从百度控制台发送推送通知。但是,与 Azure 通知中心集成时,它还需要一个“通道 ID”(请参阅​​ https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.notificationhubs.baiduregistrationdescription?view=azure-dotnet )

我们如何在 Android 中获取此频道 ID?

4

1 回答 1

0

我们在使用百度的通知中心入门中提供了有关如何与百度集成的信息,特别是需要覆盖onBind自定义PushMessageReceiver类的方法。

于 2022-02-02T16:51:35.443 回答