本文介绍了如何从 MySql 服务器到 Android 应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 MySql 数据库,其中包含一些运动结果.我想写一个Android应用来在手机上显示这些数据.

I have a MySql database with some sports results in it. I want to write an Android application to display these data on mobile phones.

我在互联网上搜索过这个问题,我认为 MySql 数据库和 Android 应用程序之间不可能直接连接.(这样对吗?)

I´ve searched on the internet for this issue, and I think it is not possible to have a direct connection between the MySql database and the Android application. (Is this right?)

所以我的问题如下:如何在 android 应用程序中访问 MySql 数据库以显示一些数据?

So my question is the following:How can I have access in the android application to the MySql database in order to display some of the data?

推荐答案

你可能想看看 C2DM (http://code.google.com/android/c2dm/).

You may want to look at C2DM (http://code.google.com/android/c2dm/).

一种常见的方法是编写一个 REST Web 服务并让 Android 调用它并从服务器获取数据.

A common way is to write a REST web service and have Android call that and get the data from the server.

如果你想推送它,如果数据足够小,你可以使用短信,将数据作为短信发送到设备.

If you want to push it, if the data is small enough, you could use SMS and just send the data as a text message to the device.

您不想开放对数据库的访问,因此通过使用网络服务可以更好地保护您的数据库.

You don't want to open access to your database so by using the web service you can better protect your database.

这篇关于如何从 MySql 服务器到 Android 应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 12:31