gpt4 book ai didi

android - 推送通知不适用于通过 Parse.com 发送的 Android 和 iOS 设备

转载 作者:行者123 更新时间:2023-11-29 02:17:46 25 4
gpt4 key购买 nike

我正在使用 Parse.com 作为后端,我正在尝试在创建同一事件时向 Android 和 iOS 设备发送推送通知。

当我从 Android 应用程序创建事件时,它仅通知 Android 设备和 iOS 设备,但不会同时使用同一事件在两个平台设备上收到通知。

重要说明:我的两种技术(Android 和 iOS)的包标识符在安装表中是不同的。

这会影响我的推送通知机制吗?

是否有任何替代解决方案可以向这两种类型的设备发送通知?

最佳答案

是的,我找到了一个解决方案:

我创建了一列“Should_notify”并为其维护 true/false 值,在编码方面我编写了查询以发送推送通知。

注意:此代码块适用于 iOS,但同样适用于 Android。

NSDictionary *data = [NSDictionary dictionaryWithObjectsAndKeys:
message, @"alert",
@"Increment", @"badge",
nil];
PFQuery *pushQuery = [PFInstallation query];

/**
* Where condition: if user or device enable Notification switch
*/

[pushQuery whereKey:@"Should_Notify" equalTo:@YES];

/**
* Send push notification with data using pushQuery
*/

[PFPush sendPushDataToQueryInBackground:pushQuery withData:data];

希望,这对您也有帮助。 :)

关于android - 推送通知不适用于通过 Parse.com 发送的 Android 和 iOS 设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28556422/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com