Yes, it is possible if you use a function in the Android application that always runs at a set time (every 1 minute, for example). This function should check whether the WebService has new notifications for this user.
Edited
I found a tutorial that shows how to consume JSON
in Android: link . Home
What you should do, is to add a method that fetches the WebService (I always use it in REST because I already know it) every x seconds / minutes every time. In the PHP application, when you run the REST method (if you have something to send to the Android application), it makes the information available and, after running Android, you must remove this information from the WS (logically or physically), so there is no duplicity of submitted information
Edited 2
After setting the AndroidManifest file so that the user has access to the internet and imported the package from the JSON
, the method is created (in this example, it runs every 5000 ms, or be, every 5 seconds):
new Timer().scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
super.onCreate(savedInstanceState);
new DownloadJsonAsyncTask()
.execute("http://meusite.com.br.meujson.json");
}
}, 0, 5000);
In WS PHP
:
<?php
$objetosJson = [];
$objetosJson[] = array('Objeto' => array('id' => 1, 'nome' => 'João'));
$objetosJson[] = array('Objeto' => array('id' => 2, 'nome' => 'Maria'));
echo json_encode($objetosJson);die;