I have a question about Android services. I want to know what is the best approach to get location variables from GPS. I am making a geolocation application using a service that implements a GPS module. And to get the location, I create a variable in the static and public method of the class, which is called from outside the class, and that’s all. To get position from GPS, I just used in my classes:
Location mLocation = ServiceGPS.getLocation (); The ServiceGPS class has this method:
public static Location getLocation () {return mLocation; }
In this case, I really do not see the point of binding to the service, since I just need to call the static method. I also thought about making a base class or implementing a LocationListener, but this method is really simple and it works and saves the code.
Thank you very much for your help and share your knowledge with me.
BR. David.
source
share