如何与MySQL的在线数据库的Andr​​oid应用程序的工作? [英] How to have Android app work with MySQL online database?

查看:142
本文介绍了如何与MySQL的在线数据库的Andr​​oid应用程序的工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我有一个Android应用程序,用户将输入文字,什么不可以的,我想存储(和以后检索)从在线数据库这个信息。目前,我有一个LAMP服务器架设在网上,我可以使用。

So I have an android app where users will be entering text and what not, and I want to store (and later retrieve) this info from an online database. Currently I have a LAMP server set up online that I can use.

我如何去这样做?我真的不知道该如何接口的Java与PHP和MySQL做这个东西可能。是否有替代解决方案,我可以看看?

How do I go about doing this? I really don't know how to interface java with PHP and MySQL to make this stuff possible. Are there alternate solutions I can look into?

感谢。

推荐答案

在你应该写一个Web服务API的Andr​​oid应用程序跟你的LAMP服务器。根据什么数据要发送/阅读你就会有很多的安全问题来处理。我不会去到所有的位置。

On your LAMP server you should be writing a web service API for your android application to talk to. Depending on what data you are sending/reading you'll have alot of security concerns to deal with. I won't go into all that here.

在你的服务器端的设置,你可以连接到使用DefaultHttpClient类网站。事情是这样的:

Once your server side is setup you can connect to your site using the DefaultHttpClient class. Something like this:

DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet("http://url.to.my.app.com");
HttpResponse response = httpClient.execute(httpGet);
// handle response

这是另一种运行(和写作)自己的Web服务将连接到有点像谷歌应用程序的后台。你仍然有一定的文字做的,但大部分的安全问题都好办了。

An alternative to running (and writing) your own web service would be to connect to something like a google apps backend. You still have some writing to do but much of the security concerns are easier to handle.

这篇关于如何与MySQL的在线数据库的Andr​​oid应用程序的工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆