如果还使用iOS,Google Play Services 8.4.0会打破Google Cloud Messaging for Android [英] Google Play Services 8.4.0 breaks Google Cloud Messaging for Android if iOS is also used

查看:112
本文介绍了如果还使用iOS,Google Play Services 8.4.0会打破Google Cloud Messaging for Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有几篇文章描述了这个问题的各个方面,但还没有一个令人满意的答案,所以我试图在这里整理它们,希望得到一个可以解决所有这些问题的权威答案。

将Google Play服务更新为8.4.0推送通知



Android通知未显示应用未运行时的内容

gcm.notification.e = 1代表什么,推入通知负载Android?



问题的要点是,如果您创建一个仅包含数据的GCM消息(即不使用通知字段,并且因此不打算它会生成一个通知)并且您包含content_available = True(这是获取所需行为所必需的iOS客户端),那么从8.4.0开始,这会在Android中产生不需要的空白通知。 8.4.0之前,一切正常。



问题的细节似乎是,如果Android客户端收到一个GCM字段它不理解,而不是忽略它,即使之前在消息中没有通知,它也会添加一个e = 1字段(可能是e意味着错误?)作为通知 ,导致它触发出现通知的代码,而不是指向应用程序处理的代码。



可能的解决方法:我想,跟踪哪些客户端是iOS的客户端以及哪些客户端是Android的服务器,并仅为iOS客户端包含content_available标记,并解决此问题。然而,过去没有必要这样做,而我的系统的构建思路是我可以对客户端类型不知道,因为它似乎是有意的。



content_available标志突然在Android上引起这些空白通知的事实看起来像是一个新引入的错误,但它会是非常有用的知道它是否是一个可能在8.5.0中修复的错误(in这种情况下,我现在可以用8.3.0构建,直到8.5.0出来),或者如果它打算成为一个永久的解决方案。如果这不会改变,那么跟踪哪些GCM注册ID属于iOS设备,哪些属于Android设备,然后每次发出两个独立的GCM请求是正确的解决方案?



感谢谷歌团队对此问题的任何官方回应。

今天我终于得到了谷歌的确认,这实际上是一个错误,并且该解决方案本周推出。我也可以确认我在8.3.0中看到的行为现在在8.4.0中的行为是一样的,所以显然这个修复完全是在服务器端完成的。



我还被告知实际上最好的做法是在服务器端将GCM消息划分到iOS设备和去Android设备的那些GCM消息之间,因为未来可能会有不同的有效载荷需要不同的有效载荷平台。


There are several posts that describe aspects of this issue, but there hasn't yet been a satisfying answer, so I'm attempting to collate them all here in hopes of getting an authoritative answer that can address all of these issues.

After updating Google play services to 8.4.0 push notifications displayed by themselves

Android notification is not showing it's content when app is not running

what does gcm.notification.e=1 stand for, into push notification payload on Android?

The gist of the problem is that if you create a GCM message with data only (i.e. not using the notification field, and thus not intending for it to generate a notification) AND you include content_available=True (which is necessary to get the desired behavior from iOS clients), then since 8.4.0, this generates a undesirable blank notification in Android. Prior to 8.4.0, everything worked just fine.

The specifics of the problem seem to be that if the Android client receives a GCM field it doesn't understand, instead of just ignoring it, it adds an "e=1" field (presumably "e" means error?) as a notification even if there was no notification in the message before, causing it to trigger the code that makes a notification appear, rather than the code that directs it to the application to be handled.

Possible workaround: I imagine that one could keep track on the server of which clients were iOS and which clients were Android, and only include the content_available tag for the iOS clients, and this problem would be solved. However, it wasn't necessary to do this in the past, and my system was built with the idea that I could be agnostic to the client types, as it seems was intended.

The fact that the content_available flag suddenly causes these blank notifications on Android seems like a bug that was newly introduced, but it would be very useful to know if it is in fact a bug that might be fixed in 8.5.0 (in which case I could just build with 8.3.0 for now until 8.5.0 comes out), or if it is intended to be a permanent solution. If this is not going to change, is the correct solution to keep track of which GCM registration IDs belong to iOS devices and which belong to Android devices, and then to send out two separate GCM requests every time?

Thanks in advance for any official responses to this question from the Google team.

解决方案

Today I finally got an acknowledgement from Google that this was in fact a bug, and that the fix was rolled out this week. I can also confirm that the behavior I was seeing in 8.3.0 now works the same in 8.4.0, so apparently the fix was done entirely on the server side.

I was also advised that it is in fact best practices to partition your GCM messages on the server side between those going to iOS devices and those going to Android devices, as there may be times in the future where different payloads may be needed for the different platforms.

这篇关于如果还使用iOS,Google Play Services 8.4.0会打破Google Cloud Messaging for Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆