[英]how to be aware of database changes without checking from android application
I'm Trying to Start an android chat room application , i can check server each 10Sec for new messages , but this is not right as you know. 我正在尝试启动一个Android聊天室应用程序,我可以检查服务器每个10Sec的新消息,但这是不对的,因为你知道。 For example when you receive an email , Automatically a Notification message Display How Can I Do This ?! 例如,当您收到电子邮件时,自动通知消息显示我该怎么做?
this is called Push Notification where you got notified from the server 这称为推送通知,您从服务器收到通知
the most common way to do this is using Google Cloud Messaging GCM 最常见的方法是使用Google Cloud Messaging GCM
http://developer.android.com/google/gcm/index.html http://developer.android.com/google/gcm/index.html
google it for some tutorials, 谷歌它的一些教程,
If you can, you should absolutely stick with GCM because it makes all the applications use the same connection which is battery and user friendly. 如果可以,您应该坚持使用GCM,因为它使所有应用程序使用相同的连接,这是电池和用户友好的。
Alternative is writing your own persistent tcp connection api or you can use MQTT. 另一种方法是编写自己的持久性tcp连接api,或者可以使用MQTT。 You can find a tutorial about it here How to Implement Push Notifications for Android 您可以在此处找到有关它的教程如何为Android实施推送通知
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.