Hi,

did you ever implement the code below to work for you in 2016 to let you fly to 
a location in Google Earth from yur Android app ?

I am looking for demo Google Earth Fly app for Android like below.


darius
------------------------------------------------------------------
How to fly to a location in Google Earth from your android app
15.11.2010StevePotell
There are not any current published API's for Google Earth Android 
version.  The current version does handle search intents.  You can 
launch Google Earth in Android and fly to a location with the 
following intent:  Please keep in mind Google could change this at any 
time and the following code might not work. 

// the new intent we will launch 
Intent myIntent = new Intent(); 

// send the intent directly to the google earth activity that can 
handle search 
myIntent.setClassName("com.google.earth", 
"com.google.earth.EarthActivity"); 

// we are doing a search query 
myIntent.setAction(Intent.ACTION_SEARCH); 

// change this address to any address you want to fly to 
myIntent.putExtra(SearchManager.QUERY, "2900 Frenchmen Street, New 
Orleans, LA"); 

// always trap for ActivityNotFound in case Google earth is not on the 
device 
try { 
    // launch google earth and fly to location 
    this.startActivity(myScanIntent); 
} 
catch (ActivityNotFoundException e) { 
    showGoogleEarthDialog(); 
} 

... 

// if the user does not have google earth prompt to download it 
private void showGoogleEarthDialog() { 

        AlertDialog.Builder downloadDialog = new AlertDialog.Builder(this); 
        downloadDialog.setTitle("Install Google Earth?"); 
        downloadDialog.setMessage("This application requires Google Earth. 
Would you like to install it?"); 
        downloadDialog.setPositiveButton("Yes", new 
DialogInterface.OnClickListener() { 
            public void onClick(DialogInterface dialogInterface, int i) { 
                Uri uri = Uri.parse("market://search? 
q=pname:com.google.earth"); 
                Intent intent = new Intent(Intent.ACTION_VIEW, uri); 
                MainActivity.this.startActivity(intent); 
            } 
        }); 
        downloadDialog.setNegativeButton("No", new 
DialogInterface.OnClickListener() { 
              public void onClick(DialogInterface dialogInterface, int i) {} 
        }); 
        downloadDialog.show(); 

} 

Happy coding

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/2b06cc10-a508-48de-aa86-44286b4e6d5f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to