I'm working on an Android app.
We have listeners for position data and camera capture which is timed on a background thread (not a service).
The timer thread dictates when the image is captured and also when the data is cached in a local sqlite db.
So, my question is how to properly store the location data as it comes in based on the listeners and pull that data so that the database can be updated as the camera capture is executed.
I can't put the location data into the database as it arrives because it is processed more frequently than the camera images and the camera images are what dominates the architecture at the moment. (Location data is supplement). However I need the location data to get a rough location of the where the image is captured.
My first thought was to have singleton store the location data. And have a semaphore on the getInstance method so if the database update is happening (after an image is captured) we don't have an error. The location data can wait for the database update or it can be lost for that particular event it doesn't really matter.
What are you thoughts? Am I on the right track? (And is this the right sub-site or would this be better on stackoverflow?)