[英]Send data to Android device Notification to IOS devices
We are using firebase to send notifications to both Android and IOS devices from server and we are using legacy FCM to send notifications . 我们正在使用Firebase从服务器向Android和IOS设备发送通知,并且正在使用旧版FCM发送通知 。 But when our app is backgrounded notification is handled by system itself and thus we couldn't handle it by app. 但是,当我们的应用程序处于后台时,通知是由系统本身处理的,因此我们无法由应用程序处理。 So we need to add data to notification to handle the notification by application itself on android side. 因此,我们需要向通知中添加数据,以在Android端由应用程序本身处理通知。
But due to we also have ios devices we couldn't remove notification from the pattern. 但是由于我们也有ios设备,因此无法从模式中删除通知。
Is there any way to send data to Android devices and notification to IOS devices? 有什么方法可以向Android设备发送数据并向IOS设备发送通知吗?
Also you may find the pattern that I mentioned at below. 您也可以找到我在下面提到的模式。
{
{
"registration_ids":[
],
"content_available":true,
"priority":"high",
"data":{
"title":"",
"text":"",
"badge": 1,
"sound": "default"
},
"notification":{
"title":"",
"body":"",
"badge": 1,
"sound": "default"
}
}
You will have to map the FCM Registration ID
with the OS Type
and store it somehow. 您将必须将FCM Registration ID
与OS Type
进行映射并以某种方式存储它。 Now when you are sending the notifications, based on the OS Type
, you will change the body structure for the notifications. 现在,当您基于OS Type
发送通知时,将更改通知的主体结构。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.