亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

谷歌地圖應用程序中未顯示地理意圖標簽

谷歌地圖應用程序中未顯示地理意圖標簽

喵喵時光機 2022-07-27 20:00:01
由于我的 Google Maps 應用程序最近更新,現在版本 10.11.1,以下代碼未按預期顯示標簽,已記錄和以前工作:  val intent = Intent(Intent.ACTION_VIEW, Uri.parse("geo:38.8951,100.0364?q=38.8951,100.0364(foo)")).setPackage("com.google.android.apps.maps")  if (intent.resolveActivity(packageManager) == null) {    intent.setPackage(null)  }  startActivity(intent)這個版本也沒有(0,0緊隨其后geo:):  val intent = Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=38.8951,100.0364(foo)")).setPackage("com.google.android.apps.maps")  if (intent.resolveActivity(packageManager) == null) {    intent.setPackage(null)  }  startActivity(intent)官方文檔中的示例代碼也沒有顯示標簽:// Display a label at the location of Google's Sydney officeUri gmmIntentUri = Uri.parse("geo:0,0?q=-33.8666,151.1957(Google+Sydney)");Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);mapIntent.setPackage("com.google.android.apps.maps");startActivity(mapIntent);
查看完整描述

3 回答

?
HUWWW

TA貢獻1874條經驗 獲得超12個贊

更新:計劃在 2022 年 1 月結束之前在 v11.12 中修復。

即使最新的地圖更新 10.12.1 仍然沒有解決方案,即使文檔仍然說我應該在 Google 的問題跟蹤器上創建問題,標簽仍然沒有顯示:https ://issuetracker.google.com/issues/129726279

希望我們很快就會有一些信息。


查看完整回答
反對 回復 2022-07-27
?
鳳凰求蠱

TA貢獻1825條經驗 獲得超4個贊

根據谷歌,這是谷歌地圖應用程序中的一個錯誤。它已在版本 11.12 中修復。



查看完整回答
反對 回復 2022-07-27
?
慕娘9325324

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)

            }

        }

    }


查看完整回答
反對 回復 2022-07-27
  • 3 回答
  • 0 關注
  • 147 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號