简体   繁体   中英

Display the map using Baidu API in Android

I want to display a map using Baidu API.

Does anyone have an idea on this. If so, can you please provide some sample application code?

I have recently faced this question too. This answer is 2 years late but maybe someone can still use it later. The answer given by iDev is clearly focused on javascript, which does not answer the question that was about Android.

Baidu offers an official "Hello BaiduMap" tutorial. The explanations are in Chinese only but the code can still be useful if you don't read Chinese.

When adding the API_KEY to your manifest you of course need to use your own key. I have described how to generate that in this answer . The difference is that for a mobile key you need to enter the SHA1 fingerprint of the keystore you use to sign your app, followed by your app's packagename specified in your manifest.

Baidu also provides a sample project demonstrating many functionalities of their maps. When downloading the libraries select the second one (described as 包括类参考、示例代码、开发包[...]) which contains the sample project, ready for import into eclipse.

I have also asked and answered a question about some more advanced baidu maps features if anyone is interested.

We can do it using the method described here .

aCallbackMethod is optional. We use it to initialize markers and other stuff to display over the map.

You can also take a look at this page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM