-1

is there a way I can get changes that are made in MySQL on server side to reflect on android application I am new to this I am unable to figure it out as far as I know it will use volley library for network and php webservices but how to implement it like if I change a value in MySQL table from an andoird app I should get changes on another app

HAMZAA
  • 21
  • 1
  • 7

1 Answers1

1

Your question is not very detailed. To answer, I will assume the following:

  • MySQL Server, providing access to a database
  • Webservice providing an REST API for the database (implemented using PHP or Jersey or Express.js or whatever)
  • Two Apps:
    • Application 'Bob', modifies data
    • Application 'Joe', wants to get updates


The process should be the following:

  1. User modifies data inside of Bob
  2. Bob uses a POST/PUT-Request to commit the new data to the REST-API of the Webservice
  3. The Webservice contacts the DB to store the received data in it.
  4. Joe wants to display the new data
  5. To get it, Joe needs to periodically check the REST-API using a GET-Request for new data.
  6. Once Bob's Request puts data into the DB, Joe's GET-Request will return the new data, so Joe is now able to use it for whatever.

Important is, that ONLY the Webservice itself directly contacts the Database. All Applications use the REST-API provided by the Webservice to access and modify the data.

shorez
  • 167
  • 10
  • I want to do something like firebase like it has listener to get data when there is a change in a specific node for example I want to track user location . location change listener will post data on MySQL but on the other app how to get that change in realtime – HAMZAA Jun 18 '18 at 20:59
  • @HAMZAA In case of web apps use websockets, on Android you could use mqtt for example.. Let the web service PUBLISH every POST/PUT it gets as to the broker. Another great way to sync mqtt and MySQL would be NodeRed – shorez Jun 18 '18 at 21:30
  • can you give me a link which explains how to do It never done anything like this before have no idea how to do it using php webservices – HAMZAA Jun 19 '18 at 07:06