I've set up an android app that stores basic information about a contact in SQLite:
I've set up an android app that stores basic information about a contact in SQLite:
You can use the combination JSON API + Retrofit . Explaining a little:
You must create a data pattern so that both your application and your remote database can "understand" the information that is shared between them. This pattern can be created using JSON, since both PHP and Android can read JSON files (using their proper libraries);
You should create a JSON API, which will be the communication standard between your application and your remote database, that is, you must create a communication "language" that PHP and Android will use to request and send data to each other;
In PHP, it is very simple to read and send data in JSON, but on Android you will need a library that reads and sends JSON data from a remote database. This library can be Retrofit.
A small example:
Data pattern : Suppose client data is represented this way in JSON
{
"cliente": {
"nome": "joao",
"email": "emaildojoao",
"endereco": "enderecodojoao"
}
}
Using Retrofit : In your application, using Retrofit, you could write the following code so that your application could pick up the client list from the site
@GET("/users/list")
List<Cliente> listaDeClientes();
In this case, when you call the listaDeClientes()
function, it automatically returns a list of Cliente
s from your site.
Remembering that this is just one of many solutions. If you are interested in this one, take a closer look and when you have more specific doubts, just come back here.