I am working on a GPS application. I want the application to react both when the location is updated as well as the status (e.g. when the availability of the LocationProvider is changed).
I have a working solution for reacting on the updates of the location. I have created a class implementing Runnable and a PositionListener that returns the location to the class impementing the Runnable interface when updated. The Runnable is called from the midlet.
Now I want to extend the functionality of my application to react on the status updates as well. My question is; What is the "pattern" for implementing a solution that should react on both location and status updates?
Solution I can think of but haven't tried:
1. Create a new runnable and positioning listener for status update.
- But what how do I use LocationListener then? I cannot initiate two, can I?
- Is it possible to have more than one instance of LocationProvider in one application? Or is it just references to the same I get when calling LocationProvider.getInstance()?
2. Pass on a text field to the providerStateChange method in the listener. But the only thing I can do then is to update the textfield, not react on the change and to things. Hence, not a good solution for my purpose.
Any advice would be helpful and most appreciated since I am new in this area.