[英]I want to access the usage time of all applications. How do i program this in flutter?
[英]when on press on ElevatedButton I want open Routing applications. Flutter
我在應用程序中獲取當前位置和目的地,當按下 ElevatedButton 時,我想在用戶移動設備中打開路由應用程序,如谷歌地圖或 Waze。
ElevatedButton(
onPressed: () {
},
),
我怎樣才能做到這一點?
使用這個package並這樣做:
Future<void> openMap(double latitude, double longitude) async {
String googleUrl = 'https://www.google.com/maps/search/?api=1&query=$latitude,$longitude';
if (await canLaunch(googleUrl)) {
await launch(googleUrl);
} else {
throw 'Could not open the map.';
}
}
最好像這樣使用這個package :
Future<void> openMap(double latitude, double longitude) async {
String googleUrl = 'https://www.google.com/maps/search/?api=1&query=$latitude,$longitude';
var _params;
Uri googleUri = Uri.parse(googleUrl).replace(queryParameters: _params);
if (await canLaunchUrl(googleUri)) {
await launchUrl(googleUri);
} else {
throw 'Could not open the map.';
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.