具有Web API延迟和SignalR通知的Android推送通知

时间:2016-05-26 11:49:07

标签: android asp.net-web-api notifications google-cloud-messaging signalr

我正在尝试借助Google云消息传递服务为Android手机实施推送通知。作为后端,我使用Web API作为服务器,它将与我的SignalR连接以从我的Web应用程序获取通知。在这里,我可以在与SignalR连接后立即获得Web API的通知。但是,在我将更新发送到GCM以发送通知之后,有时它会立即发送通知并且大部分时间通知要么不发送到移动设备而且发送时很晚。

请建议我解决问题,以便立即将消息从Web API发送到移动设备。

2 个答案:

答案 0 :(得分:0)

尝试强制系统发送心跳:

getContext().sendBroadcast(new Intent("com.google.android.intent.action.GTALK_HEARTBEAT")); getContext().sendBroadcast(new Intent("com.google.android.intent.action.MCS_HEARTBEAT"));

答案 1 :(得分:0)

经过一番努力,我发现Google推送通知服务一直存在问题,我完全删除了GCM,并开始使用Pushy Notifications,效果很好。

有关此问题的详情,请查看此链接Pushy Notifications