-2

I am working on a business accounting app in android, which will contain information like Company Details, Products, their prices, transactions, etc . Hence My server will have many MySql tables, I want my android app to communicate with the server for authentication, retrieve information , store information quickly, CRUD etc.

I have googled about PHP , JSon, and REST, but I am unable to get an example close to my needs.

What are the ways through which communication can be carried out from android app as fast as possible?

If PHP and JSON are the solution, then how do I implement it in Android? Any Examples?

Aashay Shah
  • 47
  • 2
  • 10

1 Answers1

0

Your architecture seems pretty straight forward. Have your database on a server, and a webserver hosting a php web application which will have to implement a REST api, transferring and receiving JSON over the wire, but there's nothing too spectacular or innovative about this. If you want to speed things up a framework like Symfony will provide you with a built in JsonResponse class for classic JSON communication

On the android side, you have two choices: if you use Java then use the native org.json library to encode your java data into json and then use org.apache.http classes (like DefaultHttpClient, HttpGet, HttpPost etc.) for communication with the server. An example here

If you go for a cross platform solution like apache cordova then you could use normal javascript ajax calls like XMLHttpRequest, jquery $.ajax or angular's $http.

Joe Minichino
  • 2,793
  • 20
  • 20
  • Can you also give an example of performing CRUD operations using PHP , i have a database on server and not on my own machine. – Aashay Shah Aug 10 '13 at 18:02
  • [here](http://www.9lessons.info/2012/05/create-restful-services-api-in-php.html) you will find an example of a restful php/mysql app. As for plain php/mysql crud just google it, there's thousand of examples on the web. – Joe Minichino Aug 10 '13 at 18:29
  • After retrieving JSON data How do i use in Android ? – Aashay Shah Aug 10 '13 at 19:11
  • see [here](http://stackoverflow.com/questions/9605913/how-to-parse-json-in-android) – Joe Minichino Aug 10 '13 at 19:14