Will Verduzco · Jun 24, 2013 at 03:00 pm

Intro Guide to Android Client-Server Communication

As our mobile devices become increasingly connected, client-server communications are also becoming increasingly necessary. Thankfully, a new guide has emerged that helps users setup a RESTful web API.

The new guide comes from XDA Forum Member Alkonic, and covers topics including setting up a database and PHP scrip, testing your new database server, and finally how to access this from Android. The guide is aimed towards relatively seasoned developers who have a working dev environment and have already written apps, but lack experience with MySQL or PHP.

What do budding cloud-enabled developers need to get started? Not much: an Android device to test with and a computer running on the same network, an Apache/MySQL/PHP server such as WAMP for Windows, and Postman Rest Client for Chrome. Thankfully the Alkonic also breaks summarizes the steps for those new to client-server communication:

  1. The client makes a request using a HTTP POST to a server
  2. The PHP script queries the MYSQL server
  3. The PHP script gets the SQL data
  4. The PHP script puts the data into an array and assigns keys for the values. The script then outputs the data as a JSON array. JSON (JavaScript Object Notation) is a standard for data exchange, and formats the data in a way both humans and computers can easily read.
  5. The app parses the JSON and displays the data.

To learn more, head over to the guide thread.


_________
Want something on the XDA Portal? Send us a tip!

Will Verduzco

willverduzco is an editor on XDA-Developers, the largest community for Android users. Will Verduzco is the Portal Administrator for the XDA-Developers Portal. He has been addicted to mobile technology since the HTC Wizard. But starting with the Nexus One, his gadget love affair shifted to Google's little green robot. He is also a Johns Hopkins University graduate in neuroscience and is now currently studying to become a physician. View willverduzco's posts and articles here.
Chris Gilliam · Apr 26, 2015 at 12:00 pm · 3 comments

XDA Recap: This Week In Android (Apr 18 – 25)

Here in the digital XDA newsroom, we spend our days pouring over an average of 2,500 news items and forum threads every 24 hours. Only the most timely and interesting bits survive the editing process, but the portal's front page still sees weekly counts in excess of 100 posts. This is a glut of content to absorb, especially if following the news cycle isn't your full-time job. However, the tech world is vast, and the information must flow. With this in mind, please...

XDA NEWS
Mario Tomás Serrafero · Apr 26, 2015 at 11:00 am · 3 comments

Sunday Debate: Custom ROMs vs. Modular Tweaks

Join us in a fun Sunday Debate on Mods and ROMs. Come with your opinions and feel free to read some of our thoughts, then pick your side or play devil’s advocate to get your voice heard and engage in friendly discussion. You can read our food-for-thought or jump straight into the fray below!       PLEASE NOTE THIS DEBATE IS ABOUT FUNCTIONALITY AND PRACTICALITY AND NOT ANY IMPLICATIONS. LET’S AIM FOR FRIENDLY DISCUSSION Tweaking Android is what a...

XDA NEWS
Mario Tomás Serrafero · Apr 25, 2015 at 11:00 am · 2 comments

XDA Picks: Best Apps of the Week (Apr 17 – 24)

Apps are at the front and center of any smartphone experience, and with over a million apps on the Google Play Store and new apps being submitted to our forums every day, staying up to date on the latest apps and games can be a hassle. At XDA, we don’t discriminate apps - if it’s interesting, innovative, original or useful, we mention them. The XDA Portal Team loves apps too, and we usually share and discuss the latest app releases...

XDA NEWS
Share This