Skip to content

Instantly share code, notes, and snippets.

@mitchtabian
Created September 26, 2018 15:13
Show Gist options
  • Select an option

  • Save mitchtabian/a77ca41385203f56eca3b4afa2f2d42b to your computer and use it in GitHub Desktop.

Select an option

Save mitchtabian/a77ca41385203f56eca3b4afa2f2d42b to your computer and use it in GitHub Desktop.

Revisions

  1. mitchtabian created this gist Sep 26, 2018.
    12 changes: 12 additions & 0 deletions GoogleMaps.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    String latitude = String.valueOf(49.08);
    String longitude = String.valueOf(122.45);
    Uri gmmIntentUri = Uri.parse("google.navigation:q=" + latitude + "," + longitude);
    Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
    mapIntent.setPackage("com.google.android.apps.maps");

    try{
    if (mapIntent.resolveActivity(getActivity().getPackageManager()) != null) {
    startActivity(mapIntent);
    }
    }catch (NullPointerException e){
    }