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

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

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器