标签云

微信群

扫码加入我们

WeChat QR Code

(The following question is for mobile platforms in general (iPhone, Android, Blackberry))We are integrating chat functionality into our existing application. I designed the system with a .Net web service and Sql Database to keep track of chat messages. Everything's working fine so far, when the chat window is open.I need a way to notify the user of a new message when he/she is not currently viewing the chat screen (meaning either the app is not in the foreground or they are in another section of the app (not the chat screen).Obviously, push notifications would be perfect here, but I'm not sure when I should be sending pushes.How would the client sending the message know whether or not the other guy is viewing the chat screen? Should I just be sending pushed with every single message and have the receiving device decide whether or not it needs to pop up a window or display something in a nofication bar?It seems like overkill to be pushing every single time a message is sent. How is this normally done?Any ideas at all would be greatly appreciated.Thanks.


The answer varies significantly depending on the platform - there is no one solution that covers android, iphone and blackberry, because they all have different constraints in the client code.

2019年04月18日34分11秒

Thanks for the reply. So I take it that pushing is necessary every time a new message is available for a user, and the device should sort out how it's handled of course. That's all I needed to know, thanks.

2019年04月19日34分11秒

PaulG You're welcome! And just to clarify (for future readers), it's not necessary, but your users will appreciate it (in terms of battery life, etc.)

2019年04月18日34分11秒

Pushing notification on every single message is not recommended IMHO. From Apple docs: "Sending notifications too frequently negatively impacts device battery life because a device must access the network to receive a notification."

2019年04月18日34分11秒