【问题标题】:How To render the directions when Linking Google maps App in react native?在反应原生中链接谷歌地图应用程序时如何呈现方向?
【发布时间】:2019-11-21 09:31:53
【问题描述】:

我想渲染牵引点之间的方向(当前位置,经过的位置)

我正在使用链接打开谷歌地图应用程序,当我点击按钮时,我通过了(纬度,经度),我想在地图上看到。

所以,当地图应用程序打开时,它们会将我带到我经过的位置,但没有显示我当前位置和其他地址之间的目的地,也没有任何标记,知道如何解决这些问题吗?

这是我的代码

_openMap = () => {
        const { region } = this.state;
        console.log('open directions');
        // Linking.openURL('geo:37.484847,-122.148386');
        Linking.canOpenURL(`geo:${region.latitude},${region.longitude}`).then(supported => {
            if (supported) {
                Linking.openURL(`geo:${region.latitude},${region.longitude}`);
            } else {
                alert('sorry invalid url')
            }
        });
    }

【问题讨论】:

  • 可能与this重复

标签: javascript android reactjs google-maps react-native


【解决方案1】:

使用任一:

google.navigation:q=a+street+address

google.navigation:q=latitude,longitude

来源:https://developers.google.com/maps/documentation/urls/android-intents#launch_turn-by-turn_navigation

【讨论】:

  • 太好了,谢谢
猜你喜欢
  • 1970-01-01
  • 2010-10-07
  • 2020-04-05
  • 2016-04-15
  • 2019-09-12
  • 1970-01-01
  • 2017-12-22
  • 2020-02-20
  • 2013-03-22
相关资源
最近更新 更多