Monday, April 22, 2013

[android help] Is there a Map API that will display information about a current location, but not show an actual map

android - Is there a Map API that will display information about a current location, but not show an actual map - Stack Overflow







Tell me more ×

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

















What I want to do is, through a HTTP GET request, send my location and get information about it. What I am looking for is information like traffic conditions, and road types. Is anyone aware of an API which will do this for me?


I have looked at Google maps API, however, I don't wish to have it shown on a map. I would like textual attributes in an XML Document or something similar.


My Idea is to use this information in an Android App I am developing.





























This function will give you the last known location.



private Location getMyLocation() {

// Get location from GPS if it's available

LocationManager lm = (LocationManager)getSherlockActivity().getSystemService(Context.LOCATION_SERVICE);
Location myLocation = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);

// Location wasn't found, check the next most accurate place for the current location
if (myLocation == null) {
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_COARSE);
// Finds a provider that matches the criteria
String provider = lm.getBestProvider(criteria, true);
// Use the provider to get the last known location
myLocation = lm.getLastKnownLocation(provider);
}

return myLocation;
}


Don't forget to add permissions in your manifest file.























default






.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...