Title, the same is the Baidu Map SDK development process encountered a problem, to account for the following background:
Developed an embedded Baidu map of the application, so it is almost the current Baidu Map SDK Open the main functions are used, positioning, map display, overlay markers, poi search, travel route planning, GPS navigation. And so on. Development of the SDK version of the first use because it is a consolidated version, so the SDK in each functional section is not guaranteed to be up-to-date, and has not encountered many of the forums, such as a number of individual SDK packages will be downloaded separately to integrate into an application of the conflict caused by the problem, After all, the previous integration Pack Navigation SDK or 1.1 of the positioning SDK or 5.3 of the Map SDK is used 3.5, may also be new, but compared to the current navigation 2.0 map 6.0.5 is still old.
Anyway, because I put most of the initialization classes in a separate service, the actual activity might just be part of the UI, and of course, the initialization of the map layer, But the basic can be seen as the service in the navigation initialization and map layer initialization is synchronous, when the navigation SDK1.1 did not find other exceptions, but the update to navigation 2.0 when the problem comes. The navigation is initialized as follows:
Initialize the navigation engine private void initnaviengine (activity activity) {//Display Load dialog box Dialogutil.getinstance (). Showprogressdialog ( mactivity); Baidunavimanager.getinstance (). Setnativelibrarypath (Getsdcarddir () + "/baidunavisdk_so"); Baidunavimanager.getinstance (). Init (mactivity, Getsdcarddir (), Ddapp.getinstance (). Getapplicationinfo (). PackageName, New Naviinitlistener () {String authinfo = null, @Overridepublic void onauthresult (int status, string msg) {if (0 = = status) {authinfo = "key check succeeded!";} else {authinfo = "key checksum failed," + msg;} Mactivity.runonuithread (New Runnable () {@Overridepublic void Run () {//Toast.maketext (mactivity, authinfo,// Toast.length_long). Show (); LOG.D (TAG, authinfo);});} public void Initsuccess () {///Toast.maketext (mactivity, "Baidu Navigation engine initialization succeeded",//Toast.length_short). Show (); LOG.D (TAG, "Baidu Navigation engine initialized successfully");} public void Initstart () {///Toast.maketext (mactivity, "Baidu Navigation engine Initialization Start",//Toast.length_short). Show (); LOG.D (TAG, "Baidu Navigation engine initialization started");} public void initfailed () {//Toast.maketext (mactivity, "Baidu navigation engine failed to initialize",//ToaSt. Length_short). Show (); LOG.D (TAG, "Baidu navigation engine failed to initialize"),}}, NULL/* mttscallback */);//Bnrouteguidemanager.getinstance (). Setvoicemodeinnavi ( BNRouteGuideManager.VoiceMode.Novice);//Display Load dialog box Dialogutil.getinstance (). Dismissprogressdialog ();}
The initialization of the map is as follows:
Initialize map protected void Initmapview () {if (Mmapview! = null) Deinitmapview (); mcurrentmode = locationmode.following; Mmapview = new Mapview (getactivity ()); mbaidumap = Mmapview.getmap (); mbaidumap.setmylocationenabled (true); Mbaidumap.setonmaploadedcallback (New Onmaploadedcallback () {@Overridepublic void onmaploaded () {//TODO Auto-generated method stubbisfinish = True;}}); Fl_map.addview (Mmapview); fl_map.setvisibility (view.visible);//hide Baidu Logoview child = Mmapview.getchildat (1); if ( Child! = NULL && child instanceof ImageView) {child.setvisibility (view.invisible);} Hidezoomview (Mmapview);}
It seems that the two do not conflict, but actually found a very strange problem, it seems that the map layer in the refresh of the problem, only show a piece of white, only so the emphasis is white because if it is a gray grid is likely to be key verification fails or no network, So I thought it was the map layer refresh problem, until the end may be aware of the navigation initialization of the wrong timing of the problem caused by the error, only to find the problem, that is, because the navigation engine initialization and map layer loading conflicts to cause the map layer loading failed, and then the problem is resolved, My practice is to do the initialization of the engine before initiating the navigation, and this initialization only needs to be done once, and the time is not very long, so we can completely ignore this delay.
Therefore, when the map layer loading exception does not display properly cannot drag, you can consider the situation I encountered.
Finally, I'm talking about my SDK environment, Navigation SDK 2.0 Map SDK 3.5.0 Positioning SDK 6.0.5. For members ' reference
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Android Baidu Map SDK navigation initialization and map initialization caused by conflicts