简体   繁体   中英

gcm - is it possible to know if the message is sent to an offline device?

Currently, sending a message from my server gives me an OK response, meaning the message has been forwarded to GCM and it will be received by the device unless it's offline, which it will receive once it's online. Would it be possible to determine if the device hasn't received it yet because it's currently offline?

There is no way to query the status of a GCM message after it is sent. One option would be to have your app request a delivery receipt , or manually ack the message via HTTP. Then if your server doesn't get the ack within a certain time you could then send via SMS.

As you then end up sending some messages via GCM and SMS, you will need code to de-duplicate the messages in your app.

now GCM support "message delivered to device", just set "delivery_receipt_requested": true and deal eith incomming ack..

see this

It seems you are using HTTP protocol for sending messages.

If you use XMPP instead, and add "delivery_receipt_requested": true to your JSON, GCM will send a Delivery message to you upon Delivery. (you can find the documents here )
Otherwise you have to handle it manually on HTTP.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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