有没有办法或者谷歌地图开发者有一个框架,可以使用kotlin在android stuio谷歌地图中指引你的位置到你想要去的地理位置。我在寻找一些解决方案,但似乎很难找到,甚至在谷歌地图开发人员中也找不到。
发布于 2020-07-29 23:54:05
您可以使用显式意图来启动Google Maps应用程序,并将目的地的坐标作为意图参数。
// Create a Uri from an intent string. Use the result to create an Intent.
val googleMapsIntentUri = Uri.parse(
"google.navigation:q=$destination_latitude,$destination_longitude"
)
// Create an Intent from googleMapsIntentUri. Set the action to ACTION_VIEW
val mapIntent = Intent(Intent.ACTION_VIEW, googleMapsIntentUri)
// Make the Intent explicit by setting the Google Maps package
mapIntent.setPackage("com.google.android.apps.maps")
// Attempt to start an activity that can handle the Intent
startActivity(mapIntent)https://stackoverflow.com/questions/63145237
复制相似问题