Tune up Baidu Map client try {intent = intent.getintent ("intent://map/direction?origin= Zhongguancun &destination= five crossing &mode=driving ®ion= Beijing &referer=autohome| Gasstation#intent;scheme=bdapp;package=com.baidu.baidumap;end "); if (Isinstallbyread ("Com.baidu.BaiduMap")) {startactivity (intent);//Start Call LOG.E ("Gasstation", "Baidu maps client already installed ") ; }else{log.e ("Gasstation", "Baidu Map client not installed"); }} catch (URISyntaxException e) {e.printstacktrace ();}
/** * Determine if the target app is installed * @param packagename the target app installed package name * @return If the target app is installed */private Boolean isinstallbyread (String packa Gename) {return new File ("/data/data/" + PackageName). exists (); }
For specific examples, see official website:
Http://developer.baidu.com/map/uri-intro.htm#idmykey11
Download method: Call Baidumapapi_v2_4_0. jar
Alertdialog.builder Builder = new Alertdialog.builder (activity); Builder.setmessage ("You have not installed the Baidu Maps app or app version too low, click confirm Installation?") "); Builder.settitle ("hint"); Builder.setpositivebutton ("Confirm", new Dialoginterface.onclicklistener () {@Override public void OnClick (Dia Loginterface dialog, int which) {Dialog.dismiss (); Baidumapnavigation.getlatestbaidumapapp (activity); } });
Builder.setnegativebutton ("Cancel", new Onclicklistener () {@Override public void OnClick (dialoginterface dialog, int which) {Dialog.dismiss (); } });
Builder.create (). Show ();
Android Baidu Map client call, and call. Jar Implementation Download APK