Android And Mysql Database Communication
Apps like Spotify and Instagram that their database, how fast users to click on buttons respond? How quickly without having to process the information stored in the database? For
Solution 1:
Let us take an example scenario, when you hit a like button
- the first thing to do is to store in your local DB that a user has liked a particular artist
- Based on this, you should call an API off your backend which will record this event. But this has to be asynchronous and you shouldn't run this on the Main thread
- Before you wait for a response from the API, you can go ahead and update the Android view based on the local like counter (you can use sqllite for this)
- The backend will run a cronjob to get the total amount of likes and put them into another table column
- So when a new user comes after the cronjob, he/she will see the updated counter
Post a Comment for "Android And Mysql Database Communication"