doude1917 2013-10-04 16:24
浏览 145
已采纳

使用Android的RESTful服务

I can't seem to get a grasp on getting the web-to-android concept. I was reading a bunch of stuff about RESTful services and JSON, but I never found anything that could help me. My idea is to have Access database somewhere online, and get files from it on the android app.

Where should I even begin? Say I got the DB and i got the server to put it on. Where does JSON come in play? Where are queries put into, some PHP, JSON, app itself?

As far as I could understand from all I have read, the connection should be somehow like this

WEB -- Database -- REST -- App

How does it connect to PHP, where does the PHP file go? I have seen many topics here talking about it, but everyone has already made SOME progress, I don't know where to even start. Could you direct me to some book worth reading?

Thank you

  • 写回答

1条回答

  • dphs48626 2013-10-04 16:33
    关注

    In simple JSON (JavaScript Object Notation) is a lightweight format that is used for data interchanging. see here for information.

    You will have two ends for your project, the front end (android side) and the back end(the server & php). JSON is the way the two ends talk.

    You asked how does it, i assume you mean the java code for the android side, connect to the PHP. The PHP is the language you are writing your API for JSON requests in.

    How does your java code use the api? You use REST and made HTTP POST or GET requests depending on your need.

    This article shows how to connect them together.

    EDIT

    The overall structure is the following:

    -- Create db
    -- Put db on server 
    -- create PHP webservice to fetch from db and encode in JSON
    -- use REST to make HTTP requests to get data from the database
    -- data comes back in JSON 
    -- decode JSON (using standard librarys in java)
    -- use your data
    

    Hopefully this helps

    Thank you

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集