[英]Best way to send data from DB to Android
I have a remote database (have images and text). 我有一个远程数据库(具有图像和文本)。 I want to make an android application which is get data from database when new data added to db..
我想做一个Android应用程序,当新数据添加到数据库时从数据库获取数据。
GCM is good for this project but how can i send images with GCM? GCM非常适合该项目,但如何使用GCM发送图像? (because GCM msg limit 4KB) or should i use web service ?
(因为GCM msg限制为4KB)还是我应该使用网络服务?
Any idea? 任何想法?
Thanks for helping.. 感谢您的帮助。
您可以使用GCM通知应用程序数据已更新,并且每当收到此通知时,就启动Web服务以获取数据和图像。
You can create a background service which runs in loop every each X seconds for example. 您可以创建一个后台服务,例如每隔X秒循环运行一次。 Each time the service execute its tasks (call a web service) it checks for new remote database entries.
每次服务执行其任务(称为Web服务)时,它都会检查是否有新的远程数据库条目。
At this point you can decide to display a notification to inform the user about the new entries received if this is the desired mechanism. 此时,如果这是所需的机制,则可以决定显示一条通知,以通知用户有关收到的新条目的通知。 If the user is using the app at the moment of the update, you can use loader and database observers to update the UI.
如果用户在更新时正在使用该应用程序,则可以使用加载器和数据库观察器来更新UI。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.