Baidu Navigation for Android _ PHP Tutorial

Source: Internet
Author: User
Tags macbook
Problem Set of Baidu Navigation Android edition. Baidu Navigation Android version problem set hardware and software environment MacbookProMGX72AndroidStudio1.4 Cobi Cube 7-inch tablet Baidu Navigation SDK3.0.0 run navigation Demo first use regular road number, apply to open Baidu Navigation Android version Problem Set
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);

Middleware 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 or regular number of roads, apply to open...

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.