简体   繁体   English

Web 服务 + Android

[英]Web Services + Android

I'm starter with web services (and practically in web development) and I'd like to connect my Android app with a web server. I'm starter with web services (and practically in web development) and I'd like to connect my Android app with a web server. I have readed that the best way for doing that is implementing a REST+JSON server.我已经读过,最好的方法是实现一个 REST+JSON 服务器。 I have no full control over the server (just a control panel) and is no dedicated for me.我无法完全控制服务器(只是一个控制面板),也不是我专用的。 I had thought implementing that with PHP.我曾想过用 PHP 来实现它。 Is ok?好吗? If yes, should I manually pharse the JSON chains of text or there are any library for simplify this step?如果是,我应该手动解析 JSON 文本链还是有任何库可以简化此步骤? Thanks in advance提前致谢

In PHP there are a few libraries for creating/using JSON.在 PHP 中有一些用于创建/使用 JSON 的库。 This link has a nice comparison of many of these popular libraries.链接对许多这些流行的库进行了很好的比较。

Android has native support for JSON. Android 原生支持 JSON。 Here is the package with the pertinent classes.这是带有相关类的 package

For PHP you only need to know json_encode() and json_decode() this will turn an array into JSON and vice-versa.对于 PHP 您只需要知道 json_encode() 和 json_decode() 这会将数组转换为 JSON ,反之亦然。

And as per @nicholas Android has native support.根据@nicholas Android 具有本机支持。

I have a well-used REST class that I can give you too if needed.我有一个很好用的 REST class 如果需要我也可以给你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM