android跳转到地图app

0.首先判断是不是有地图app

1.直接把经纬度和地址名称传过去

//geo:latitude,longitude
//geo:latitude,longitude?z=zoom,z表示zoom级别,值为数字1到23
//geo:0,0?q=my+street+address
//geo:0,0?q=business+near+city

Uri mUri = Uri.parse("geo:39.940409,116.355257?q=商家名称");
Intent mIntent = new Intent(Intent.ACTION_VIEW, mUri);
startActivity(mIntent);

跳到地图app要直接进入导航功能

1.高德

Intent intent = new Intent();
intent.setData(Uri
        .parse("androidamap://route?sourceApplication=softname"
                + "&slat=36.2&slon=116.1&sname=abc&dlat=36.3"
                + "&dlon=116.2&dname=def&dev=0&m=0&t=1&showType=1"));
startActivity(intent);
2.百度

Intent intent = new Intent();
intent.setData(Uri
        .parse("baidumap://map/direction?origin=中关村&"
                + "destination=五道口&mode=driving®ion=北京"));
startActivity(intent);

你可能感兴趣的:(Android开发)