android 百度地图 客户端调用,及调用 .jar 实现下载apk

//调起百度地图客户端 try {     intent = Intent.getIntent("intent://map/direction?origin=中关村&destination=五道口&mode=driving&region=北京&referer=Autohome|GasStation#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end");     if(isInstallByread("com.baidu.BaiduMap")){         startActivity(intent); //启动调用          Log.e("GasStation", "百度地图客户端已经安装") ;     }else{          Log.e("GasStation", "没有安装百度地图客户端") ;     } } catch (URISyntaxException e) {     e.printStackTrace(); }

 

 

/**  * 判断是否安装目标应用  * @param packageName 目标应用安装后的包名  * @return 是否已安装目标应用  */   private boolean isInstallByread(String packageName) {    return new File("/data/data/" + packageName).exists();    }

具体事例见官网:

http://developer.baidu.com/map/uri-intro.htm#idmykey11

 

 

 

下载方法:调用 baidumapapi_v2_4_0 .jar

AlertDialog.Builder builder = new AlertDialog.Builder(activity);    builder.setMessage("您尚未安装百度地图app或app版本过低,点击确认安装?");    builder.setTitle("提示");    builder.setPositiveButton("确认",      new DialogInterface.OnClickListener() {       @Override       public void onClick(DialogInterface dialog, int which) {        dialog.dismiss();        BaiduMapNavigation.GetLatestBaiduMapApp(activity);       }      });

   builder.setNegativeButton("取消", new OnClickListener() {     @Override     public void onClick(DialogInterface dialog, int which) {      dialog.dismiss();     }    });

   builder.create().show();

你可能感兴趣的:(android)