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 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误