3 回答

TA貢獻1874條經驗 獲得超12個贊
更新:計劃在 2022 年 1 月結束之前在 v11.12 中修復。
即使最新的地圖更新 10.12.1 仍然沒有解決方案,即使文檔仍然說我應該在 Google 的問題跟蹤器上創建問題,標簽仍然沒有顯示:https ://issuetracker.google.com/issues/129726279
希望我們很快就會有一些信息。

TA貢獻1783條經驗 獲得超4個贊
我認為我們在這里的做法是錯誤的。如果我是谷歌,我也會對允許開發人員發布帶有抽象目的地標簽的路線感到不安全,我相信他們永遠不會打算解決這個問題。
我根據谷歌的新標準推薦以下解決方案。https://developers.google.com/maps/documentation/urls/android-intents:
https://www.google.com/maps/dir/?api=1&destination=LATITUDE,LONGITUDE
如果您查看當今大多數應用程序,包括我構建的應用程序,這允許我們發布 LAT/LONG 供用戶使用 Google 自己的內置地址值作為目標標簽。
要真正啟動 Google 地圖應用程序,只需啟動一個 Web 意圖,我在本例中使用應用程序上下文。
fun startGoogleMaps(context: Context, lat: Double, long: Double) {
startWebBrowser(
context,
Uri.parse("https://www.google.com/maps/dir/?api=1&destination=$lat,$long")
)
}
fun startWebBrowser(context: Context, link: Uri?) {
if (link != null) {
val webIntent = Intent(Intent.ACTION_VIEW, link).apply {
addFlags(FLAG_ACTIVITY_NEW_TASK)
}
if (webIntent.resolveActivity(context.packageManager) != null) {
context.startActivity(webIntent)
}
}
}
添加回答
舉報