简体   繁体   English

从数据库向Android发送数据的最佳方法

[英]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.

相关问题 将整个.db文件从Android Wear发送到智能手机的最佳方法是什么? - What is the best way to send whole .db file from android wear to smartphone? 通过设备发送数据的最佳方法? (Android) - Best way to send data through devices? (Android) 将数据从ArrayAdapter发送到MainActivity的最佳方法 - Best way to send data from ArrayAdapter to MainActivity 从android->服务器->另一个android实时发送数据的最佳方式 - best way to send data from android->server->another android in realtime 从我的 android 应用程序将传感器数据发送到我的计算机的最佳方式是什么? - What is the best way to send sensor data to my computer from my android app? 使用Java从Android向Web服务器发送和接收数据(POST和GET)的最佳方式? - Best way to send and receive data(POST and GET) from Android to web server using Java? 试图找出通过Android将数据发送到服务器的最佳方法 - Trying to figure out the best way to send data to a server via android 在一次传输中将数据/文件发送到Android中服务器的最佳方法 - Best way to send data/files in one transmission to server in android 从 url 下载 .db 并使用它的最佳方法。 安卓工作室 - Best way to download .db from url and use it. Android Studio 从服务器发送.zip到Android应用的最佳方法 - Best way to send .zips to an Android app from a server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM