鸿蒙平台,添加是否支持推送音视频消息的配置

This commit is contained in:
imndx
2024-10-30 20:40:59 +08:00
parent 96a15ce628
commit 187ba7c766
3 changed files with 17 additions and 2 deletions

View File

@@ -6,4 +6,10 @@ hm.iss=1002***
# 请使用服务帐号密钥文件中的key_id替换
hm.kid=184d3688732245d***
# 项目 id
hm.projectId=38842184***
hm.projectId=38842184***
# 音视频通话推送 需要申请特别的推送权限请参考https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/push-apply-right-V5#section7291115452410
# 只有支持 voip push 之后, 才能接入 callkit实现后台弹出音视频通话邀请横幅
# 不支持 voip push 时,将在通知栏显示一条 xxx邀请你进行音视频通话的提示
hm.supportVoipPush=false

View File

@@ -12,6 +12,7 @@ public class HMConfig {
private String iss;
private String kid;
private String projectId;
private boolean supportVoipPush = false;
public String getPrivateKey() {
return privateKey;
@@ -44,4 +45,12 @@ public class HMConfig {
public void setProjectId(String projectId) {
this.projectId = projectId;
}
public boolean isSupportVoipPush() {
return supportVoipPush;
}
public void setSupportVoipPush(boolean supportVoipPush) {
this.supportVoipPush = supportVoipPush;
}
}

View File

@@ -87,7 +87,7 @@ public class HMPushServiceImpl implements HMPushService {
return null;
}
if (pushMessage.pushMessageType == PushMessageType.PUSH_MESSAGE_TYPE_VOIP_INVITE || pushMessage.pushMessageType == PushMessageType.PUSH_MESSAGE_TYPE_VOIP_BYE) {
if (config.isSupportVoipPush() && pushMessage.pushMessageType == PushMessageType.PUSH_MESSAGE_TYPE_VOIP_INVITE || pushMessage.pushMessageType == PushMessageType.PUSH_MESSAGE_TYPE_VOIP_BYE) {
VoipPayload voipPayload = VoipPayload.buildAlertPayload(pushMessage);
String response = httpPost(this.pushUrl, jwt, 10, voipPayload.toString(), 10000, 10000);
LOG.info("Push voip message to {} response {}", pushMessage.getDeviceToken(), response);