2016-12-09 2 views
0

Google지도 안드로이드에서 자신의 자격 증명을 사용하여 내비게이션을 호출하면 탐색 버튼이 보이지 않습니다.Google지도에서 내비게이션 버튼을 볼 수 없음 android

이것은 내 활동에서 호출하는 코드입니다.

public void NavigatePath(){ 

    Uri gmmIntentUri = Uri.parse("http://maps.google.com/maps?" + "saddr=" + Sourcelat + "," + Sourcelong + "&daddr=" + Destinationlat + "," + Destinationlong); 
    Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); 
    mapIntent.setPackage("com.google.android.apps.maps"); 
    startActivity(mapIntent); 
} 

내비게이션 버튼을 보는 방법을 권해주십시오.

답변

1

내가 이것을 사용하고, 그것은 완벽하게 작동 :

String uri = String.format(Locale.ENGLISH, "http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f", sourceLatitude, sourceLongitude, destinationLatitude, destinationLongitude); 
      Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); 
      intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity"); 
      try 
      { 
       startActivity(intent); 
      } 
      catch(ActivityNotFoundException ex) 
      { 
       try 
       { 
        Intent unrestrictedIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); 
        startActivity(unrestrictedIntent); 
       } 
       catch(ActivityNotFoundException innerEx) 
       { 
        Toast.makeText(this, "Please install google maps application!", Toast.LENGTH_LONG).show(); 
       } 
      } 
+0

확인을 내게 그것은 나를 위해 작동 – Umesh

+0

을 확인하게하지만 난 채워 소스와 대상을 싶어. 자기 소유로 채워지지 않았다. – Umesh

+0

업데이트 된 답변 확인 –

관련 문제