Nowadays, PHP and Android are widely used platforms, while PHP is used for dynamic web development, Android is an OS for mobiles, tablets etc. To develop Android applications we can use the benefits of PHP to communicate it with MySQL database and get required data from there.
We can use JSON and HTTP as an intermediate of communication between Android and PHP. The whole process can be divided into five steps:
1) An HTTP request is sent from Android(Client) to PHP(Server).
2) PHP runs it’s script to make connection with database, and send request to MySQL database for required data.
3) MySQL responds back to PHP with requested data.
4) PHP script analyse the date and coverts it into information. The whole information is then converted into JSON format and sent to the Android (Client).
5) Android script reads the data, perform its operations and shows it on it’s screen.
The Whole process has also been described in the following diagram.