There is basically a database handler and the UI and the foreground service need to communicate constantly using the Messenger
to update the database and synchronize themselves. It'd be really convenient if I could share this particular object with the foreground service and the UI. How do I do that(if there is a way)? In particular, I'd like to access it's variables, methods etc. It is going to be something that is to be used across different activities, processes and services but for instance I'm just taking it to work with a foreground service.
Also, if they are not shared,i.e an individual copy of them exists ,if I close the database from either the foreground service or the UI, will the database be closed wholly or do I need to close it twice?