Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flying to lat/lon with Google Earth Android intent

I'm using the following code to fly to a specific latitude and longitude using a Google Earth Android intent:

Intent myIntent = new Intent(); 

myIntent.setClassName("com.google.earth", "com.google.earth.EarthActivity"); 
myIntent.setAction(Intent.ACTION_SEARCH); 
myIntent.putExtra(SearchManager.QUERY, lat + " " + lon);

This works pretty much OK, except that it seems to want to geocode the lat/lon to the nearest address, if one is within a certain range. That is, if the lat/lon is in the middle of Antarctica, the map centers on the given point, but if the coordinates are, say, of the Sphinx, the map centers on an address on Cairo Alex Desert Rd., some distance away.

Is there a way to make Google Earth for Android just go to the given lat/lon in all cases?

like image 733
Joe Knapp Avatar asked Nov 30 '25 15:11

Joe Knapp


1 Answers

Try this:

Uri uri = Uri.parse("geo:38.899533,-77.036476");
Intent it = new Intent(Intent.Action_VIEW,uri);
startActivity(it);
like image 56
Dave Hoskins Avatar answered Dec 03 '25 05:12

Dave Hoskins



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!