我们正在尝试整合百度SDK,并在后端与Azure通知中心一起使用它。
在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://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.notificationhubs.baiduregistrationdescription?view=azure-dotnet)
如何在Android中获得这个通道Id?
发布于 2022-02-02 16:51:35
我们有关于如何在开始使用百度的通知中心上与百度集成的信息,特别是需要覆盖自定义PushMessageReceiver类的onBind方法。
https://stackoverflow.com/questions/70958237
复制相似问题