How to launch map intent with a marker/overlay item at given latitude and longitude?

前端 未结 2 680
不知归路
不知归路 2021-02-03 14:21

I have a latitude and longitude and I want to open google maps centred at that point. So i use the following code for it:

Intent intent = new Intent(android.cont         


        
2条回答
  •  轮回少年
    2021-02-03 15:02

    You can use it like,

    Showing Particular Place,

    Uri uri = Uri.parse("geo:0,0?q=22.99948365856307,72.60040283203125
                                                                   (Maninagar)");
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    startActivity(intent);
    

    Showing Route between to Places,

    Intent intent = new Intent(Intent.ACTION_VIEW,
    Uri.parse("http://maps.google.com/maps?saddr="+23.0094408+","+72.5988541+"&
                                daddr="+22.99948365856307+","+72.60040283203125));
    startActivity(intent);
    

提交回复
热议问题