android 使用place_id从flutter应用程序打开谷歌Map

lhcgjxsq  于 2024-01-04  发布在  Android
关注(0)|答案(1)|浏览(132)
  1. class MapUtility {
  2. static Future<void> openLocation(String placeId) async {
  3. Uri googleUrl =
  4. Uri.parse('https://www.google.com/maps/place/?q=place_id:$placeId');
  5. if (!await launchUrl(googleUrl)) {
  6. throw Exception("Could not open google map");
  7. }
  8. }
  9. }

字符串
我尝试用place id打开google map,但是android不支持,在ios中Map可以完美的打开,但是在android中我在搜索栏得到place_id:<place's id>
屏幕截图从android设备:


的数据

9rygscc1

9rygscc11#

你可以使用map_launcher flutter来启动带有place_id的googleMap。
看看这里的额外参数。
编辑:不要忘记遵循URL指南here

相关问题