I'm writing an Android App and I'm looking for the fastest (In terms of setup) way for me to send data to a server and receive information back on request.

我正在编写一个Android应用程序,我正在寻找最快的(在设置方面)方式让我将数据发送到服务器并根据请求接收信息。

We're talking basic stuff. I have a log file which tells me how a user is using my application (In beta, I wouldn't runin a user experience by constantly logging usually) and I want to communicate that to my server (That I haven't setup).

我们正在谈论基本的东西。我有一个日志文件告诉我用户如何使用我的应用程序(在测试版中,我不会通过不断记录常常运行用户体验)并且我想将它传达给我的服务器(我没有设置)。

I don't need security, I don't need high throughput or concurrent connections (I have 3 phones to play with) but I do need to set it up fast!

我不需要安全性,我不需要高吞吐量或并发连接(我有3个手机可以玩)但我确实需要快速设置它!

I remember back in the day that setting up XAMPP was particularly brainless, then maybe I could use PHP to send the file from the phone to the Server?

我记得当天设置XAMPP特别没脑子,那么也许我可以使用PHP将文件从手机发送到服务器?

The Server would ideally be able to respond to a GET which would allow me to send back some SQL statements which ultimately affect the UI. (It's meant to adapt the presented options depending on those most commonly used).

理想情况下,服务器能够响应GET,这将允许我发回一些最终影响UI的SQL语句。 (这意味着根据最常用的选项调整所呈现的选项)。

So there you have it, I used PHP about 4 years ago and will go down that route if it's the best but if there's some kind of new fangled port open closing binary streaming singing and dancing method that has superseeded that option I would love to know.

所以,你有它,我使用大约4年前的PHP,并将走这条路线,如果它是最好的,但如果有一种新的fangled端口打开关闭二进制流媒体唱歌和跳舞方法已取代该选项,我很想知道。

This tutorial seems useful but I don't really need object serialization, just text files back and forth, compressed naturally.

这个教程看起来很有用,但我不需要对象序列化,只需来回文本文件,自然压缩。

Android comes with the Apache HTTP Client 4.0 built in as well as java.net.URL and java.net.HttpUrlConnection, I'd rather not add too much bult to my App with third party libraries.

Android附带了内置的Apache HTTP Client 4.0以及java.net.URL和java.net.HttpUrlConnection,我宁愿不用我的第三方库添加太多bult。

Please remember that I'm setting up the server side as well so I'm looking for an overall minimum lines of code!

请记住,我也在设置服务器端,所以我正在寻找总体最小代码行!

4 个解决方案

#1


private void sendData(ProfileVO pvo) {

    Log.i(getClass().getSimpleName(), "send  task - start");

    HttpParams p=new BasicHttpParams();
    p.setParameter("name", pvo.getName());

    //Instantiate an HttpClient
    HttpClient client = new DefaultHttpClient(p);

    //Instantiate a GET HTTP method
    try {
        HttpResponse response=client.execute(new HttpGet("http://www.itortv.com/android/sendName.php"));
        InputStream is=response.getEntity().getContent();
        //You can convert inputstream to a string with: http://senior.ceng.metu.edu.tr/2009/praeda/2009/01/11/a-simple-restful-client-at-android/
    } catch (ClientProtocolException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    Log.i(getClass().getSimpleName(), "send  task - end");
}

更多相关文章

  1. 错误”. lang。当使用带有ViewPager的选项卡时,IllegalStateExcep
  2. 【边做项目边学Android】手机安全卫士04_02:从服务器下载并安装新
  3. Java项目无法通过BufferedWriter向服务器写数据?
  4. Android网络编程-----从服务器端获取xml数据并解析
  5. JustWe-WebServer Android上的Http服务器
  6. Android SDK更新以及ADT更新出现问题的解决办法(附google服务器
  7. android 打开系统相册得到路径 上传图片到php服务器
  8. POST json和图像到服务器android
  9. 阿里云服务器上部署java项目(安装jdk,tomcat)

随机推荐

  1. android 压缩图片、生成缩略图 和转换Bas
  2. android EditText TextView的属性整理 最
  3. Android平板开发注意点
  4. android RelativeLayout属性和布局实例
  5. android surfaceView 概述
  6. Android实现3个圆圈的动画
  7. Android简易注解View(java反射实现)
  8. android解析json小例子
  9. AndroidManifest.xml之 element详解
  10. android讲义9之向电话本进行批处理的插入