Android - How to launch Google map intent in android app with certain location, zoom level and marker

后端 未结 4 764
北荒
北荒 2020-11-30 01:16

Map Intent not working with specific zoom level as well as custom marker

    float lat = 40.714728f;
    float lng = -73.998672f;

    String maplLabel = \"A         


        
4条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-30 01:55

    Show location in maps application:

    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    String data = String.format("geo:%s,%s", latitude, longitude);
    if (zoomLevel != null) {
        data = String.format("%s?z=%s", data, zoomLevel);
    }
    intent.setData(Uri.parse(data));
    startActivity(intent);
    

提交回复
热议问题