鸿蒙平台,添加是否支持推送音视频消息的配置
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user