I'm wondering how can I make notification on my website when Android post data.
For example : The website have index.php and post.php.
Then, I use POST request to send data to website(through post.php) from Android. At this time I would like to show notification to all user who is being index.php.
How can I do that ?
-
You can add one parameter to your POST set that says, "cameFromAndroid=true". Or something...durbnpoisn– durbnpoisn2016-03-07 18:12:21 +00:00Commented Mar 7, 2016 at 18:12
2 Answers
You're asking for a backend (POSTing data to the server) that will update the current front end (index.php presentation) for multiple users.
I'm assuming here you've already got an API sorted for communicating to the back end on your post.php - something that allows you to pass an update. So lets address index.php:
You'll need to use Websockets to inform clients of an update. A popular solution for this is Ratchet and it's commonly used to write chat clients that need to receive and send information from clients.
Comments
I completed agree with @Liam Martin Websockets is a good approach for this case, another solution could be, in your index.php you could create ajax request that keep checking if there is a new post from a android devices.
OR
You could give a try to https://www.firebase.com/ is very handy, when you want to real develop time app.