我正在尝试设置一个共享位置本身链接的位智功能。
此功能用于打开位智应用。
handleWazeLocation = (address, lat, lng) => {
let ll = lat + "," + lng;
this.waze.setll = ll;
this.waze.setSearchQuery = address;
console.log(this.waze);
this.waze.open()
};
和这里打开位的按钮。
<Button
buttonType={'default'}
onPress={() => this.handleWazeLocation(address, lat, lng)}>
我需要一个与该功能相同的功能(按钮),该功能使我可以在whatssup或Gmail中共享位智的位置,并在开机时触发。
答案 0 :(得分:0)
您正在查看深度链接,并且两个应用程序都有各自的URL方案。
首先,您需要通过执行以下操作来修改handleWazeLocation
函数:
import { Linking } from 'react-native';
handleWazeLocation = (...) => {
// Rest of your code
Linking.openURL(); // You need to pass the URL scheme depending on WhatsApp/Gmail
}
您可以找到WhatsApp文档here。
要使用Hello World打开WhatsApp,您需要打开whatsapp://send?text=Hello%2C%20World!
。
Gmail
对于Gmail,您将需要发送here
中的以下内容googlegmail:///co?subject=<subject text>&body=<body text>