Android Baidu map sdk3.2 offline map package import, androidsdk3.2
Some time ago, when I used Baidu map to import an offline map package, I found a problem. The offline packages downloaded from the Baidu official website cannot be imported, but I can download offline packages using the Baidu map demo, at that time, there was no requirement on the method. You could use the demo to download the offline package. Recently, there were requirements on the method. You must use the offline package method.
The demos of Baidu map cannot be imported, and then we can check them online. Haha, all kinds of people in the same path are suffering. After careful observation, we found some doorways and hope to help you.
First, after downloading the Baidu offline map package, there is a folder under vmp under BaiduMap. Note that this is a letter named, H or l, the problem occurs in the two names.
Baidu has the following sentence:
Premise: Get the resolution of your mobile phone.
Operation: After selecting the brand, select "high-split screen package (resolution: 480*800 and above)" or "low-split screen package (resolution: 480*800)" at the bottom of the model drop-down list)
Note: For example, 540*960 use the high-split screen package (resolution: 480*800 or above)
The resolution of my tablet seems to be 1024*600. Because it is an industrial tablet, I use htc one s without my brand. After the download, I use h in vmp, copy, paste, it cannot be imported
By accident, I found that the offline map I downloaded using the demo is under vmp/l, andLFile, so I think it may be an error in the offline package.
Then download the package again from the official Baidu MAP website. When the brand is htc and the model is selected, pull the drop-down list box to the bottom, select the low-split screen package, and then import the package.
The scan method is useless, and mOffline. importOfflineData () is used directly ();
Main Code:
The activity needs implements MKOfflineMapListener to automatically add one
@ Override
Public void onGetOfflineMapState (int arg0, int arg1 ){
// TODO Auto-generated method stub
}
MKOfflineMap mOffline = new MKOfflineMap ();
MOffline. init (this );
Int num = mOffline. importOfflineData ();
String msg = "";
If (num = 0 ){
Msg = "The offline package is not imported. This may be because the location of the offline package is incorrect or the offline package has already been imported ";
Else {
Msg = String. format ("% d offline packages imported successfully, you can view them in download management", num );
}
Toast. makeText (this, msg, Toast. LENGTH_SHORT). show ();
It is successful.