Has*_*sya 15 push-notification ios firebase google-cloud-messaging pushkit
有没有人对Firebase Cloud Messaging支持VOIP pushkit服务有所了解.
如果是,那么有人可以提供相同的指导.
同样的事情在Skype/Hangout/WhatsApp或任何其他基于VOIP的应用程序中实现.
提前致谢.
Ian*_*ber 13
在撰写本文时(FirebaseMessaging 1.1.0/Firebase 3.2.0),FCM在iOS下使用常规APN,因此不支持PushKit通知.
这对我有用!不要忘记在您的目录中添加 Authkey_xxxx.p8 文件,并且不要忘记将 .voip 添加到通知主题中的捆绑包 ID。
export const test = functions.https.onRequest((request, response) => {
const config = {
production: false, /* change this when in production */
token: {
key: "./AuthKey_xxxx.p8",
keyId: "xxxx",
teamId: "yyyy"
}
};
const apnProvider = new apn.Provider(config);
const notification = new apn.Notification();
const recepients: string[] = [];
recepients.push(apn.token('SOME PUSHKIT TOKEN'));
recepients.push(apn.token('ANOTHER PUSHKIT TOKEN'));
notification.topic = 'com.your.app.voip'; // you have to add the .voip here!!
notification.payload = {
// some payload
};
return apnProvider.send(notification, recepients).then((reponse) => {
console.log(reponse);
return response.send("finished!");
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8220 次 |
| 最近记录: |