Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android谷歌地图应用程序直接跳转到特定位置_Android_Google Maps_Google Maps Android Api 2 - Fatal编程技术网

Android谷歌地图应用程序直接跳转到特定位置

Android谷歌地图应用程序直接跳转到特定位置,android,google-maps,google-maps-android-api-2,Android,Google Maps,Google Maps Android Api 2,我正在使用下面的代码打开谷歌地图应用程序,并将用户重定向到特定位置 @Override public void openMap(EService service) { if (service != null && UString.stringsExist(service.latitude, service.longitude, service.address)) { Intent intent = new Intent(Intent.ACTION_VIE

我正在使用下面的代码打开谷歌地图应用程序,并将用户重定向到特定位置

@Override
public void openMap(EService service) {
    if (service != null && UString.stringsExist(service.latitude, service.longitude, service.address)) {

        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(
                "geo:<" + service.latitude + ">,<" + service.longitude + ">?q=<" + service.latitude + ">,<" + service.longitude + ">(" + service.address + ")")
        );

        try {
            startActivity(intent);
        } catch (ActivityNotFoundException e) {
            Toast.makeText(this, getString(R.string.toast_no_application_found_for_action), Toast.LENGTH_SHORT).show();
        }

    }
}
@覆盖
公共void openMap(电子服务服务){
if(service!=null&&UString.stringsExist(service.latitude、service.longitude、service.address)){
Intent Intent=新的Intent(Intent.ACTION\u视图,Uri.parse(
“geo:,?q=,(“+service.address+”)
);
试一试{
星触觉(意向);
}捕获(ActivityNotFounde异常){
Toast.makeText(this,getString(R.string.Toast\u no\u application\u found\u for\u action),Toast.LENGTH\u SHORT.show();
}
}
}
问题是,当应用程序打开时,它首先跳到我当前的位置,然后在一秒钟后移动到我给它的位置。有没有办法直接移动到我指定的位置

编辑

我在运行4.3的S3上。

为什么要添加“”作为纬度/经度的分隔符

根据文档,正确的方法是:

Uri gmmIntentUri = Uri.parse("geo:"+ service.latitude +","+ service.latitude +"?q="+ service.latitude + "," + service.longitude + "(" + service.address + ")");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);

如果关闭移动设备中的位置服务会发生什么情况?不。。那也不行。。。我以为有一秒钟是这样的,但没有…:(如果你不进行查询(删除所有以
?q=
开头的内容),你会有同样的行为吗?)不会,删除
?q=
之后的所有内容会使它不会跳到任何位置…根本不会。它确实在坐标顶部有一个标记位置,但不会使相机移动到该位置。它不会放大。。。