简体   繁体   中英

How to realize Android send data to PHP - MySQL?

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'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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM