Baidu navigation Android FAQ

Source: Internet
Author: User

Baidu navigation Android FAQ
Software and hardware environment

  • Macbook Pro MGX 72
  • Android Studio 1.4
  • Cobi cube 7-inch tablet
  • Baidu navigation SDK 3.0.0
Run navigation Demo

First, we need to apply for a developer account and create an application.

Baidu Dev Center

Next, download the Demo project. The address is release. Modify the AndroidManifest. xml file in the project menu, add the applied Key to the file, and run the project again. The navigation interface is displayed.

Baidu Navi Demo UI "path calculation failed"

The longitude and latitude information of the two locations (121.387211, 31.088074) and (121.523014, 31.277986) are found on the network. One is used as the start point and the other as the end point, and the navigation function BNRoutePlanNode is called, the error message "failed to calculate the path" is displayed. Later, we found that the order of the real parameters was longitude, And the latitude was at the beginning. After the order was changed, the navigation was successful.

No voice

When opening the demo, I found an error in logcat.

bdTTSGetAuthorize failed! 

This is because the SDK built-in Baidu TTS voice broadcast function, the need for app authorization authentication can be used, authorization method is http://developer.baidu.com/map/index.php? Title = android-navsdk/guide/voice

Offline Map

In the Demo provided by Baidu map SDK, an example of downloading the city map resource package offline is provided. Use the default path to see the onCreate function in BaseMapDemo. java.

@ Override public void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); Intent intent = getIntent (); if (intent. hasExtra ("x") & intent. hasExtra ("y") {// when intent parameter is used, set the center point to the specified point Bundle B = intent. getExtras (); LatLng p = new LatLng (B. getDouble ("y"), B. getDouble ("x"); mMapView = new MapView (this, new BaiduMapOptions (). mapStatus (new MapStatus. builder (). target (p ). build ();} else {mMapView = new MapView (this, new BaiduMapOptions ();} setContentView (mMapView); mBaiduMap = mMapView. getMap ();}

When the current activity does not contain values (the key values are x and y, corresponding to the longitude and latitude information), the map of Beijing is displayed by default. After knowing this, you can pass the value to change the default map display, as shown in the following example:

Bundle bundle = new Bundle();bundle.putDouble("y",31.088074);bundle.putDouble("x",121.387211);intent.putExtras(bundle);startActivity(intent);

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.