简体   繁体   中英

Android connection to mysql Database with php server

I am about to make an app that connect to database and update listview every X seconds (connection via WiFi).

My questions:

  1. Is it a good solution to keep connected app to wifi and update the list eg. every 10 seconds?
  2. What is the easiest way to communicate with database via php scripts? I was looking for this and found example with HttpClient but in Android Studio it says that this is deprecated. Then I found HttpURLConnection but I have got no clue how to use it.

Thanks in advance for your help.

  1. I think that's not quite good way. That will consume much battery and server's traffic will increase. Try push or increase interval. 10 seconds is too short.

  2. Try this . I use this when I need a connection between server.

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