Push Notification from Device to Device over Local

2019-07-28 01:05发布

I will have two android tablets working in the same retail location, both connected to a local network.

A customer will use one tablet to place an order. That tablet needs to send a notification to another tablet when the order is placed.

I am using a MySql database, and I could poll constantly from the tablet that needs to receive information, but that would drain the battery.

I could use C2DM, but it is absolutely necessary that the system works even if there is an internet slowdown/loss of connectivity.

How can I do what is basically C2DM over a local network from android device to android device? No android device will have cell phone service.

2条回答
小情绪 Triste *
2楼-- · 2019-07-28 01:51

Before the introduction of C2DM we used the XMPP protocol to provide Push Notification.. the best library to acomplish that function was asmack.

Althought, C2DM works perfectly with loss of connectivity (when you reconnect you receive the missed messages)

查看更多
霸刀☆藐视天下
3楼-- · 2019-07-28 01:58

You've asked a general question so the best I can do is give you a general answer. Traditionally, Long Polling has been used in this situation. Essentially, the first tablet polls the second tablet. When the second tablet gets the poll request it just sits on it until it actually has something to tell the other device. Once it has a message to send to the other device, it responds to that initial poll request.

查看更多
登录 后发表回答