Learning content from "MU class network"
Baidu Map SDK Download http://developer.baidu.com/
Http://bbs.lbsyun.baidu.com/forum.php?mod=viewthread&tid=9554&extra=page%3D1
1. Get the secret key
App name casually written, Application type: Android SDK
Here is a security code Baidu gave the hint: Android SDK Security Code composition: Digital Signature +;+ package name.
Digital Signature Acquisition Method: Click the last Preferences in the window at the back of the menu bar, you can see the signature of SHA1 in the open Windows Android--build.
Fill in the security code with the signature and the package name, and note that there is a semicolon between the signature and the package name
2. Download the relevant SDK
Click on the relevant download to
Select the required features to download the development kit
3, after the download is complete,
Click Development Guide---hellow baidumap
This teaches us how to introduce projects.
It's very simple here, just follow his instructions and take one step at a pace.
After the completion of the phone can be tested, can be realistic map function.
4. Add some features to the map below
①, scale displayed on open
1 Private Baidumap Mbaidumap; 2 mbaidumap = mmapview.getmap (); 3 // Setting the display ratio when opening the column shows around 500m 4 Mapstatusupdate MSU = Mapstatusupdatefactory.zoomto (15.0f5 Mbaidumap.setmapstatus (MSU);
②, realizing the switch of satellite map and normal map
1 @Override2 Publicboolean Oncreateoptionsmenu (Menu menu) {3 //TODO auto-generated Method Stub4 5 getmenuinflater (). Inflate (R.menu.main, menu);6 return true;7 }8 @Override9 Publicboolean onoptionsitemselected (MenuItem item) {Ten //TODO auto-generated Method Stub One Switch(Item.getitemid ()) { A CaseR.id.id_map_common: - Mbaidumap.setmaptype (baidumap.map_type_normal); - Break; the CaseR.id.id_map_site: - Mbaidumap.setmaptype (baidumap.map_type_satellite); - Break; - Caser.id.id_map_traffic: + if(mbaidumap.istrafficenabled ()) - { +Mbaidumap.settrafficenabled (false); AItem.settitle ("Real-time traffic (off)"); at } - Else - { -Mbaidumap.settrafficenabled (true); -Item.settitle ("Real-time traffic (on)"); - } in Break; - to default: + Break; - } the returnsuper.onoptionsitemselected (item); *}
The corresponding Main.xml
1<menu xmlns:android="http://schemas.android.com/apk/res/android">2 3<Item4Android:id="@+id/id_map_common"5 6android:showasaction="never"7android:title="General Map"/>8<Item9Android:id="@+id/id_map_site"Ten Oneandroid:showasaction="never" Aandroid:title="Satellite map"/> -<Item -Android:id="@+id/id_map_traffic" the -android:showasaction="never" -android:title="Real-time traffic (off)"/> - +</menu>
Note: If the test found that the map does not show the Whiteboard, it may be a secret key error, to adhere to the security code is correct
Android Development _ Mu Class network _ Baidu Map