urksiful

Google Maps API Navigation Sample

Jul 19th, 2018
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. private void initNav(){
  2.  
  3.  
  4.         String dLatitud="19.6893579";
  5.         String dLongitud="-100.5505599";
  6.  
  7.         //Uri gmmIntentUri = Uri.parse("google.navigation:q="+dLatitud+","+dLongitud+"");
  8.         //destino=""Eréndira+A+León+20"";
  9.         Uri gmmIntentUri = Uri.parse("google.navigation:q="+destino+"");
  10.         Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
  11.         mapIntent.setPackage("com.google.android.apps.maps");
  12.         Log.d("Dummy FB", gmmIntentUri.toString());
  13.         if(mapIntent.resolveActivity(getPackageManager())!=null){
  14.             startActivity(mapIntent);
  15.         }else{
  16.             Toast.makeText(this, "Instala Google Maps para continuar", Toast.LENGTH_SHORT).show();
  17.         }
  18.     }
Add Comment
Please, Sign In to add comment