简体   繁体   English

推送通知会在某些设备上经过很长时间后到达

[英]Push notifications arrive after a long time on some devices

On Android, I have been experiencing long push delay in some devices (minutes, half an hour). 在Android上,我在某些设备上经历了长时间的推送延迟(几分钟半小时)。 Seems like the device is asleep (but not for WhatsApp). 似乎该设备正在睡眠(但不适用于WhatsApp)。 Even on Pre-Marshmallow devices. 即使在棉花糖前设备上。

After a while they don't respond to push . 一段时间后他们对推送没有反应

I have created a simple app (copied Google's Cloud Messaging client sample ). 我创建了一个简单的应用程序(复制了Google的Cloud Messaging客户端示例 )。

Tried to send push via The Firebase Console, setting priority to HIGH and made sure it works. 尝试通过Firebase控制台发送推送,将优先级设置为HIGH并确保它可以工作。

  • Experiment 1: After a while - tried to send. 实验1:过一会儿-尝试发送。 The device is not responding. 设备无响应。

  • Experiment 2: Tried to use Telegram and WhatsApp. 实验2:尝试使用Telegram和WhatsApp。 Message passes immediately on both. 消息立即传递给双方。

  • Experiment 3: Tried the my test app again. 实验3:再次尝试了我的测试应用。 Not working. 不工作

  • Experiment 4: Tried to downgrade from FCM to GCM and all the way to C2DM. 实验4:尝试从FCM降级到GCM,并一直降级到C2DM。 Same thing, not working. 同样的事情,不起作用。

Any ideas? 有任何想法吗?

To make it clear: 明确说明:

  • The token is okay. 令牌还可以。 In most cases it works. 在大多数情况下,它可以工作。 It just falls asleep after a while. 过了一会儿就睡着了。
  • It's a Lollipop device so no Power Saving exempts here or battery saving . 这是Lollipop装置,因此这里没有节电功能或节电功能
  • I use priority:high on the payload. 我对有效负载使用priority:high
  • It is no server issue because I use FCM composer and it's just the same. 这不是服务器问题,因为我使用的是FCM作曲器,而且是一样的。
  • Waking the device does not necessarily fix it. 唤醒设备并不一定要修复它。 It just begins to receive notifications minutes later and then all ok. 几分钟后它才开始接收通知,然后一切正常。
  • Other apps such as WhatsApp work without problem whatsoever, always. 其他应用程序(如WhatsApp)始终可以正常工作。
  • I tried C2DM, GCM, FCM. 我尝试了C2DM,GCM,FCM。 I am using a printout on the C2DM receiver. 我在C2DM接收器上使用打印输出。 They all behave the same. 它们的行为都一样。
  • I log everything. 我记录了一切。 Every event, broadcast I get. 每一个事件,我得到的广播。 I don't get push when I should. 我什么时候都不会被推。

Possible clue: some of my customers are using VMWare AirWatch. 可能的线索:我的一些客户正在使用VMWare AirWatch。 anybody know about any issues related to AirWatch and Push? 有人知道与AirWatch和Push相关的任何问题吗?

This is not a complete answer so I can't mark this question "Answered". 这不是一个完整的答案,因此我无法将此问题标记为“已回答”。

I found some alternative push mechanism called Pushy . 我发现了另一种称为Pushy的推送机制。 It's mentioned quite a lot in Stack Overflow. 在Stack Overflow中已经提到了很多。

Pros: 优点:

  • I have made tests on a phone where FCM and GCM failed. 我在FCM和GCM失败的手机上进行了测试。 Pushy succeeded to deliver all my messages, always. Pushy始终成功地传达了我所有的信息。
  • It can work on devices with no Google Play Services enabled 它可以在未启用Google Play服务的设备上运行
  • It is also a workaround for the SERVICE_NOT_AVAILABLE issue. 这也是解决SERVICE_NOT_AVAILABLE问题的一种解决方法。
  • They have a nice friendly console like in FCM, where you can send test messages. 他们有一个像FCM一样友好的控制台,您可以在其中发送测试消息。
  • You get a feedback when the message was delivered to Android devices. 当邮件传递到Android设备时,您会收到反馈。
  • Has topics like in FCM so you can send one message to a group. 在FCM中有类似的主题,因此您可以向群组发送一条消息。

Cons: 缺点:

  • Money. 钱。 It costs. 它的成本。 Not too much. 不会太多 Last time I checked it was 0.5Cent per month for each active user. 我上次检查的价格是每个活跃用户每月0.5Cent。 It may be a lot but my app is an emergency app so availability is a must in my case. 可能很多,但我的应用程序是紧急应用程序,因此对于我来说,可用性是必须的。
  • Does not have retries like FCM, as far as I understood. 据我了解,没有像FCM这样的重试功能。 I may be wrong but it does not handle many things that FCM does. 我可能是错的,但它不能处理FCM所做的许多事情。 It may not do exponential back-off retries or Notification Messages A-la-Apple. 它可能不执行指数退避重试或通知消息A-la-Apple。 I personally hate FCM behaviour on that so I am fine with this. 我个人讨厌FCM的行为,因此我对此表示满意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM