I have followed this tutorial and now I have a working activity with google map fragment.
I need to keep track on the location of my app's users - the fragment has a onLocationChanged
method which fires when location is changed, and on that method I update My Database with the user's location, draw the user on the map and more stuff.
The only issue is - I want to also have a service that will always send updates to my database and update each user's location, also when the app is closed.
Should I put the onLocationChanged
method in both the fragment and service somehow? because when the app is on the foreground, I also do more things on the onLocationChanged
beside updating the database, like drawing the map etc.