ConnectyCube React Native VoIP 推送令牌问题
ConnectyCube React Native VoIP push token issue
这是我正常成功订阅apn或gcm频道
subcribeToPushNotification(deviceToken) {
const params = {
notification_channels: Platform.OS !== 'ios' ? 'apns' : 'gcm',
device: {
platform: Platform.OS,
udid: DeviceInfo.getUniqueId()
},
push_token: {
environment: __DEV__ ? 'development' : 'production',
client_identification_sequence: deviceToken
}
}
// JS SDK v2
/*ConnectyCube.pushnotifications.subscriptions.create(params)
.then(result => {console.log("RESULT: ", result)})
.catch(error => {console.log("ERROR: ", error)});*/
// JS SDK v1
ConnectyCube.pushnotifications.subscriptions.create(
params,
(error, result) => {
if (result)
console.log("RESULT APNS: ", result)
else
console.log("ERROR VOIP", error)
}
);
}
现在我需要使用 VOIP 推送通知,但是当我尝试以下代码时:
subcribeToPushNotificationVoip(deviceToken) {
const params = {
notification_channels: Platform.OS === 'ios' ? 'apnsvoip' : 'gcm',
device: {
platform: Platform.OS,
udid: DeviceInfo.getUniqueId()
},
push_token: {
environment: __DEV__ ? 'development' : 'production',
client_identification_sequence: deviceToken
}
}
// JS SDK v2
/*ConnectyCube.pushnotifications.subscriptions.create(params)
.then(result => {console.log("RESULT: ", result)})
.catch(error => {console.log("ERROR: ", error)});*/
// JS SDK v1
ConnectyCube.pushnotifications.subscriptions.create(
params,
(error, result) => {
if (result)
console.log("RESULT APNS: ", result)
else
console.log("ERROR VOIP LAST: ", error)
}
);
}
console.log
给我这个错误:
ERROR VOIP LAST: {"code": 422, "detail": ["Invalid notification channel specified"], "message": {"errors": ["Invalid notification channel specified"]}, "status": "error"}
voip 令牌示例:4dd23c212d2a8865c4747ee278de0947d0de80445400f8f85cdb5a6f3923cb74
我正在使用通用(沙盒和生产及 VoIP)SSL 证书
对于 VoIP,它应该是
notification_channel: "apns_voip"
对于 VoIP 推送,订阅用户时需要生成一个单独的推送令牌,请查看如何获取它 https://github.com/react-native-webrtc/react-native-voip-push-notification#usage
然后当检索到令牌时,您需要通过在订阅请求中传递'apns_voip'频道来订阅voip推送
当你想发送 voip 推送通知时,在创建事件时也使用“apns_voip”频道
这是我正常成功订阅apn或gcm频道
subcribeToPushNotification(deviceToken) {
const params = {
notification_channels: Platform.OS !== 'ios' ? 'apns' : 'gcm',
device: {
platform: Platform.OS,
udid: DeviceInfo.getUniqueId()
},
push_token: {
environment: __DEV__ ? 'development' : 'production',
client_identification_sequence: deviceToken
}
}
// JS SDK v2
/*ConnectyCube.pushnotifications.subscriptions.create(params)
.then(result => {console.log("RESULT: ", result)})
.catch(error => {console.log("ERROR: ", error)});*/
// JS SDK v1
ConnectyCube.pushnotifications.subscriptions.create(
params,
(error, result) => {
if (result)
console.log("RESULT APNS: ", result)
else
console.log("ERROR VOIP", error)
}
);
}
现在我需要使用 VOIP 推送通知,但是当我尝试以下代码时:
subcribeToPushNotificationVoip(deviceToken) {
const params = {
notification_channels: Platform.OS === 'ios' ? 'apnsvoip' : 'gcm',
device: {
platform: Platform.OS,
udid: DeviceInfo.getUniqueId()
},
push_token: {
environment: __DEV__ ? 'development' : 'production',
client_identification_sequence: deviceToken
}
}
// JS SDK v2
/*ConnectyCube.pushnotifications.subscriptions.create(params)
.then(result => {console.log("RESULT: ", result)})
.catch(error => {console.log("ERROR: ", error)});*/
// JS SDK v1
ConnectyCube.pushnotifications.subscriptions.create(
params,
(error, result) => {
if (result)
console.log("RESULT APNS: ", result)
else
console.log("ERROR VOIP LAST: ", error)
}
);
}
console.log
给我这个错误:
ERROR VOIP LAST: {"code": 422, "detail": ["Invalid notification channel specified"], "message": {"errors": ["Invalid notification channel specified"]}, "status": "error"}
voip 令牌示例:4dd23c212d2a8865c4747ee278de0947d0de80445400f8f85cdb5a6f3923cb74
我正在使用通用(沙盒和生产及 VoIP)SSL 证书
对于 VoIP,它应该是
notification_channel: "apns_voip"
对于 VoIP 推送,订阅用户时需要生成一个单独的推送令牌,请查看如何获取它 https://github.com/react-native-webrtc/react-native-voip-push-notification#usage
然后当检索到令牌时,您需要通过在订阅请求中传递'apns_voip'频道来订阅voip推送
当你想发送 voip 推送通知时,在创建事件时也使用“apns_voip”频道