How do I show a marker in Maps launched by geo URI Intent?

后端 未结 7 1665
离开以前
离开以前 2020-11-28 02:47

I have a application where I want to show different locations (one at the time, picked by user input) by launching Google Maps with their specific geo coordinates.

I

7条回答
  •  没有蜡笔的小新
    2020-11-28 03:12

    There are many more options to launch a Google map using an intent...

       Double myLatitude = 44.433106;
       Double myLongitude = 26.103687;
       String labelLocation = "Jorgesys @ Bucharest";
    

    1)

    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:<" + myLatitude  + ">,<" + myLongitude + ">?q=<" + myLatitude  + ">,<" + myLongitude + ">(" + labelLocation + ")"));
        startActivity(intent);
    

    2)

    String urlAddress = "http://maps.google.com/maps?q="+ myLatitude  +"," + myLongitude +"("+ labelLocation + ")&iwloc=A&hl=es";
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlAddress));
        startActivity(intent);
    

    3)

       String urlAddress = "http://maps.googleapis.com/maps/api/streetview?size=500x500&location=" + myLatitude  + "," + myLongitude + "&fov=90&heading=235&pitch=10&sensor=false";
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlAddress));
            startActivity(intent);
    

提交回复
热议问题