I have a few little questions regarding GPS in Android:
How can I determine whether GPS is available on the device?
I found several links for determining the coordinates of the current location开发者_JS百科. Is there any way to determine the city/state/country based on these coordinates?
To your first question. You can try to get a certain LocationProvider
by calling the getProvider() method of the LocationManager
. If the requested provider is available it returns the LocationProvider if not it returns null.
Your second question. Yes you can do that with the GeoCoder. By calling the getFromLocation() method and passing it the latitude, longitude and a value for the maximum addresses you'd like to obtain.
精彩评论