1
votes

is there a way to determine, if a push notification can be delivered right now? As far as i know its not possible, but im not sure about it.

So my scenario looks like this: I have a android app I have my own server

My app on my android phone should communicate with my app on my friends android phone. Now im looking for a realtime communication framework and i guess C2DM could help me.

So lets say: My app on phone A should write a little message to my app on phone B. Lets assume, phone A is online and can communicate with my server. So phone A would send the message to my server, and my server would now try to deliver this message to phone B.

And thats the point, where my server would try to deliver the message to phone B via C2DM, and thats also the point, where my server needs to know, if its possible to send this message via C2DM or not. Otherwise my server should use another communication way to deliver the message, like sms or whatever.

So the point is, that i really need to know if its possible at this very moment to deliver to Phone B via C2DM (of course my server knows the C2DM Registration ID of Phone B). Otherwise, for example if Phone B is not connected to the internet and can not receive C2DM push notifications, my server would send a sms to phone B.

Is it possible, to dertemine if phone B is online? What i try to do is, to reach every user (if his phone is turned on). If he is online, then via C2DM, otherwise via SMS, so that the message is delivered at this very moment in any way.

Note: I know that C2DM can store notifications and deliver the stored notifications when phone B is online, but thats not the way i want to use it. Note also, that i know (architectural) how to use C2DM. So the "message", that should be delivered from phone A to phone B will not be delivered directly in a C2DM push notification with the message text / sensitive data as message body. Of course the delivered message is only a "update message" to tell my app on phone B, that something has changed and the app should connect now to my server to get (polling) the latest state with the "text message" which has been sent from phone A to you (phone B)

1

1 Answers

1
votes

is there a way to determine, if a push notification can be delivered right now?

No. There is no guarantee that a C2DM message will ever be delivered, let alone immediately.

Is it possible, to dertemine if phone B is online?

Phone B can know if it is online. If you implement a server with some sort of long-held socket connection (e.g., XMPP), that server can know if it has an open socket connection with Phone B.