首页 > 解决方案 > 具有特定语言的谷歌地图意图

问题描述

我想用特定语言(如英语、印地语、卡纳达语等)打开谷歌地图。是否可以在用于谷歌地图意图的 URI 中发送语言环境?

我正在使用以下代码打开谷歌地图,

val muri = "google.navigation:q=" + pickupLatitude + "," + pickupLongitude + "&mode=l"
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(muri))
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK
startActivity(intent)

遵循以下解决方案,但它不起作用

String uri = String.format(Locale.ENGLISH, "http://maps.google.com/maps? 
saddr=%f,%f(%s)&daddr=%f,%f (%s)", sourceLatitude, sourceLongitude, "Home Sweet Home", 
destinationLatitude, destinationLongitude, "Where the party is at");
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
intent.setPackage("com.google.android.apps.maps");
startActivity(intent);

标签: androidgoogle-mapsandroid-intent

解决方案


推荐阅读