Parse.com推送通知延迟或仅在Android应用程序重新启动后

当测试parse.com推送通知(从afterCave上的CloudCode发送)时,有一些奇怪的事情。

有时Android应用程序会立即得到通知(低于1秒),但有些时候会延迟多秒。
重新启动应用似乎会导致尚未收到的通知立即出现。

可能是什么原因?
这可能是一个错误,例如,parse.com服务?

可以发送或接收多少通知(每单位时间)是否有限制?

问题同时发生在自定义的BroadcastReceiver和默认的系统栏通知上。

服务器端JavaScript CloudCode:

Parse.Cloud.afterSave("Timer", function(request) { // from https://www.parse.com/docs/js/guide#cloud-code console.log("Before Parse.Push.send -- without alert"); var query = new Parse.Query(Parse.Installation); // http://blog.parse.com/announcements/pushing-from-the-javascript-sdk-and-cloud-code/ : Parse.Push.send({ where: query, data: { //alert: "afterSave on a Timer -- Parse.Push.send" } }); console.log("After Parse.Push.send -- without alert"); }); 

Kotlin中的自定义广播接收器(但问题也没有自定义BroadcastReceiver):

 override fun onCreate(savedInstanceState: Bundle?) { super<BaseActivity>.onCreate(savedInstanceState) setContentView(R.layout.main_activity) // ... registerReceiver() } private fun registerReceiver() { val intentFilter = IntentFilter() intentFilter.addAction("com.parse.push.intent.RECEIVE") registerReceiver(MyBroadcastReceiver(), intentFilter) } inner class MyBroadcastReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { Toast.makeText(context, "MyBroadcastReceiver 2: onReceive: " + context + ";" + intent, Toast.LENGTH_SHORT).show() loadTimers() } } 

我们目前正在使用一个未付款的parse.com帐户。 这是否会影响对推送通知的反应的及时性?

编辑:如果您认为使用推送通知触发近实时的项目更新/同步不是一个好主意(无论是在一般还是在parse.com),这也是一个有价值的答案,特别是如果提出了一个替代方案…

在karolvrn的建议,这是我的答案:

我不认为有即时传送推送通知的保证。

https://developers.google.com/cloud-messaging/concept-options#setting-the-priority-of-a-message

您有两个选项可用于为下游消息分配投递优先级:普通优先级和高优先级。 高优先级消息和普通优先级消息的传递如下所示:

  • 高度重视。 GCM 尝试立即传送高优先级的消息,允许GCM服务在可能的情况下唤醒休眠设备,并打开与应用服务器的网络连接。
  • 正常优先。 这是邮件传递的默认优先级…

我强调了“企图”,这意味着它不保证消息将立即传递。

以下是另一位开发人员关于GCM可靠性问题的经验:

https://eladnava.com/google-cloud-messaging-extremely-unreliable/