简体   繁体   English

在React Native中链接Google Maps App时如何呈现方向?

[英]How To render the directions when Linking Google maps App in react native?

I want to render the directions between tow point (current location, passed location) 我想渲染两个拖曳点之间的方向(当前位置,通过的位置)

I'm using Linking to open the Google Maps App when clicking the button I passed the (lat, long), I want to see in the map. 当我点击希望在地图上看到的(经纬度)按钮时,我正在使用“链接”打开Goog​​le Maps App。

so just when the Maps App open they get me to the Location I passed without display the destination between my current location and other address and without any Markers, any idea how to solve these? 因此,仅在打开Goog​​le Maps App时,他们便将我带到我经过的位置,而没有显示我当前位置和其他地址之间的目的地,并且没有任何标记,是否知道如何解决这些问题?

地图

Here is my Code 这是我的代码

_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')
            }
        });
    }

Use either: 使用以下任一方法:

google.navigation:q=a+street+address

or 要么

google.navigation:q=latitude,longitude

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM