目录

Map Kit Manual Conversion Guide

Precautions

[h2]Preparations

[h2]gradle File Configuration

[h2]Conversion from switch-case to if-else

After the conversion is complete, case expressions must be constant expression is displayed for some statements selected using switch-case. The case in switch must be an exception expressed in a constant. This method needs to be converted to the if-else format to resolve the switch exception.

Original sample code:

switch (reason) {
    // REASON_GESTURE: gesture
    case OnCameraMoveStartedListener.REASON_GESTURE:
        currPolylineOptions.color(Color.BLUE);
        reasonText = "GESTURE";
        break;
    //REASON_API_ANIMATION: API animation
    case OnCameraMoveStartedListener.REASON_API_ANIMATION:
        currPolylineOptions.color(Color.RED);
        reasonText = "API_ANIMATION";
        break;
    //REASON_DEVELOPER_ANIMATION: developer animation
    case OnCameraMoveStartedListener.REASON_DEVELOPER_ANIMATION:
        currPolylineOptions.color(Color.GREEN);
        reasonText = "DEVELOPER_ANIMATION";
        break;
}

Modified sample code:

if (OnCameraMoveStartedListener.getREASON_GESTURE() == reason) {
    this.currPolylineOptions.color(Color.BLUE);
    reasonText = "GESTURE";
} else if (OnCameraMoveStartedListener.getREASON_API_ANIMATION() == reason) {
    this.currPolylineOptions.color(Color.RED);
    reasonText = "API_ANIMATION";
} else if (OnCameraMoveStartedListener.getREASON_DEVELOPER_ANIMATION() == reason) {
    this.currPolylineOptions.color(Color.GREEN);
    reasonText = "DEVELOPER_ANIMATION";
} else {
    reasonText = "UNKNOWN_REASON";
}

fragment

After the Add HMS API conversion is complete, you can configure the ClassLoader (simple, only resource import and configuration file modification are required) or manually write code (complex, heavy manual conversion workload) to implement the compatibility of Google APIs and HMS for activity displayed in fragment.

Currently, the ClassLoader solution does not support the plug-in or hot fix framework in projects, and does not support ClassLoader customization. If your app has such requirements, manually write the code.

For more information about the ClassLoader solution, please refer to Basic Principles of the XClassLoader Solution.

[h2]Configuring the ClassLoader

Currently, the ClassLoader does not support Add HMS API conversion in Library mode. Select the App mode when using the tool for conversion.

After automatic conversion, manually convert APIs in dummy state in all files through Conversion.

  1. Modify the project-related configuration files.
    1. If Generate code for creating app dependent only on GMS SDK is selected and the single xmsg flavor variant is enabled, modify the reference configuration in the project-level settings.gradle file as follows:
      include ':xmsadapter:xmsaux', 'xmsadapter:xmsaux:xg', 'xmsadapter:xmsaux:xapi'
      If Generate code for creating app dependent only on HMS SDK is selected and the single xmsh flavor variant is enabled, modify the reference configuration in the project-level settings.gradle file as follows:
      include ':xmsadapter:xmsaux', 'xmsadapter:xmsaux:xh', 'xmsadapter:xmsaux:xapi'
      If any of the preceding modes is selected and the single xmsgh flavor variant is enabled, modify the reference configuration in the project-level settings.gradle file as follows:
      include ':xmsadapter:xmsaux', 'xmsadapter:xmsaux:xg', 'xmsadapter:xmsaux:xh', 'xmsadapter:xmsaux:xapi'

      For details about the flavor variants, please refer to Using Convertor to Generate Multiple Variant APKs.

    2. In the dependencies {} section of the project-level build.gradle file, set the Gradle plug-in version to 3.5.0 or later.
      buildscript {
          dependencies {
              classpath 'com.android.tools.build:gradle:3.5.0'
          }
      }
    3. In the project-level gradle/wrapper/gradle-wrapper.properties file, set the Gradle version to 5.4.1 or later.
      distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
    4. For a multi-module project, add the following configuration to the gradle.properties file in the project-level directory:
      android.enableD8=false
      android.enableD8.desugaring=false
  2. Call the init method at the program entry to initialize the program.
    1. Implement a program entry class that inherits android.app.Application in the app and override the onCreate method in the class.
      public class MyApp extends Application {
          @Override
          public void onCreate() {
              super.onCreate();
              GlobalEnvSetting.init(this,null);
              XLoader.init(this);
          }
      }
    2. Modify the application name attribute in the app-level src/main/AndroidManifest.xml file and add the new application subclass in the first entry.
      <application
          android:name=".MyApp"
      </application>
  3. Handle the exception.
    1. If a rescanning is performed, you will see the message shown in the following figure. In this case, back up and remove the xh, xg, and xmsaux folders from the xmsadapter folder. After the rescanning is complete, restore the backup to the xmsadapter folder.

    1. To ensure your app security, Huawei provides the security verification function for the xg.apk and xh.apk resource files in the assets directory of the APK. If the error message "Apk File is corrupted" is displayed during the running process, the resource files have been tampered with or damaged. Clean and rebuild the entire project before APK packaging.

    2. If the following error message is displayed when your app is running on an Android device of an earlier version,

      Add the following configuration to app/build.gradle:

      android {
          defaultConfig {
              multiDexEnabled false
          }
      }

[h2]Manually Writing Code

  1. Modify the layout resource files.

    In the Add HMS API scenario, Google APIs and HMS need to use independent layout resource files. The <fragment/>class paths in the resource files are different.

    Reference for the fragment definition in the HMS layout resource file:

    <fragment
         android:id="@+id/map"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         class="com.huawei.hms.maps.SupportMapFragment" />

    Reference for the fragment definition in the Google API layout resource file:

    <fragment
         android:id="@+id/map"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         class="com.google.android.gms.maps.SupportMapFragment" />
    Resource file reference:
    • basic_demo: original layout resource file.
    • basic_demo_hms: layout resource file of HMS.

    Each layout resource file must be in duplicate, one for HMS and the other for Google APIs. The files are used together with the code for compatible redirection.

  1. Modify the code.

    If Fragment is used, you can use if-else in the onCreate() method of activity to make a copy of the code compatible with both HMS and Google APIs. The modification method is as follows:

    Original sample code:
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
          // Configure the GMS resource file.
        setContentView(R.layout.events_demo);
        mTapTextView = (TextView) findViewById(R.id.tap_text);
        mCameraTextView = (TextView) findViewById(R.id.camera_text);
         // Load SupportMapFragment in the onCreate() method of the Activity.
        SupportMapFragment mapFragment =
                 (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
         // Call getMapAsync() to register a callback.
        mapFragment.getMapAsync(this);
    }

    Modified sample code:

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
         // Create according to G or H based on the current type.
        if (org.xms.g.utils.GlobalEnvSetting.isHms()) {
            createAsH();
        } else {
            createAsG();
        }
    }
    /**
      * HMS creation process.
      */
    private void createAsH() {
        Log.d(TAG, "create as hms");
         // Set the HMS resource file.
        setContentView(R.layout.events_demo_hms);
         // Initialize the parameter.
        initMember();
         // Obtain the HMS fragment based on the ID.
        com.huawei.hms.maps.SupportMapFragment hMapFragment =
                 (com.huawei.hms.maps.SupportMapFragment) this.getSupportFragmentManager().findFragmentById(R.id.map);
         // Load a map.
        hMapFragment.getMapAsync(this.getHInstanceOnMapReadyCallback());
    }
    /**
      * GMS creation process.
      */
    private void createAsG() {
        Log.d(TAG, "create as gms");
         // Configure the GMS resource file.
        setContentView(R.layout.events_demo);
         // Initialize the parameter.
        initMember();
         // Obtain the GMS fragment based on the ID.
        com.google.android.gms.maps.SupportMapFragment gMapFragment =
                 (com.google.android.gms.maps.SupportMapFragment) this.getSupportFragmentManager()
                         .findFragmentById(R.id.map);
         // Load a map.
        gMapFragment.getMapAsync(this.getGInstanceOnMapReadyCallback());
    }
    /**
      * Initialize member variables and extract them into independent methods.
      */
    private void initMember() {
        this.mTapTextView = (TextView) findViewById(R.id.tap_text);
        this.mCameraTextView = (TextView) findViewById(R.id.camera_text);
    }
    Specify Google APIs or HMS to load map resources based on isHms in the current environment variable. The options are as follows:
    • void initMember(): initialization position of private member variables and code that can be shared.
    • void createAsG(): Google API creation process.
    • void createAsH(): HMS creation process.

Map Constants

After the conversion is complete, please refer to the following table if an exception occurs in the reference of constants. In Google Maps, constants are directly used. However, in the Add HMS API scenario, constants are used in Getter mode. For example:

For BitmapDescriptorFactory.HUE_ORANGE, the new method is to use BitmapDescriptorFactory.getHUE_ORANGE() in Getter mode.

Obtaining Google Maps Constants

Obtaining Add HMS API Constants

import static com.google.android.gms.maps.GoogleMap.MAP_TYPE_HYBRID (directly used after reference)

ExtensionMap.getMAP_TYPE_NORMAL()

BitmapDescriptorFactory.HUE_ORANGE

BitmapDescriptorFactory.getHUE_ORANGE()

HuaweiMap.OnCameraMoveStartedListener.REASON_API_ANIMATION

HuaweiMap.OnCameraMoveStartedListener.getREASON_API_ANIMATION()

Obtaining Google Maps Constants

Obtaining To HMS API Constants

import static com.google.android.gms.maps.GoogleMap.MAP_TYPE_HYBRID (directly used after reference)

import static com.huawei.hms.maps.HuaweiMap.MAP_TYPE_HYBRID (directly used after reference)

Special Fragment Scenarios (OnMapAndViewReadyListener)

Some demos such as Marker implement the OnMapAndViewReadyListener.OnGlobalLayoutAndMapReadyListener API. The Fragment used supports conversion in the OnMapAndViewReadyListener class in the Add HMS API scenario. The modification is as follows.

streetViewPanoramaFragment

In the Add HMS API scenario, the call method of fragment (please refer to fragment) is slightly different from that of streeViewPanoramaFragment. However, the basic approach is to perform if-else processing based on the system type. The reference is as follows.

Sample code of modifying onCreate in activity

Original sample code:

protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.street_view_panorama_basic_demo);
    SupportStreetViewPanoramaFragment streetViewPanoramaFragment =
             (SupportStreetViewPanoramaFragment)
                     getSupportFragmentManager().findFragmentById(R.id.streetviewpanorama);
    // Set a callback object, which will be triggered when the GoogleMap instance is ready.
    streetViewPanoramaFragment.getStreetViewPanoramaAsync(
        new OnStreetViewPanoramaReadyCallback() {
            // Called when the streetscape panorama is ready.
            @Override
            public void onStreetViewPanoramaReady(StreetViewPanorama panorama) {
                // Only set the panorama to SYDNEY on startup (when no panoramas have been
                // loaded which is when the savedInstanceState is null).
                if (savedInstanceState == null) {
                    panorama.setPosition(SYDNEY);
                }
            }
        });
}
Modified sample code:
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (org.xms.g.utils.GlobalEnvSetting.isHms()) {
        createAsH(savedInstanceState);
    } else {
        createAsG(savedInstanceState);
    }
}
private void createAsH(final Bundle savedInstanceState) {
    Log.d(TAG, "create as hms");
    setContentView(R.layout.street_view_panorama_basic_demo_hms);
    initMember();
    com.huawei.hms.maps.SupportStreetViewPanoramaFragment hStreetViewPanoramaFragment =
             (com.huawei.hms.maps.SupportStreetViewPanoramaFragment) getSupportFragmentManager().findFragmentById(R.id.streetviewpanorama);
    hStreetViewPanoramaFragment.getStreetViewPanoramaAsync(panorama -> {
        // Only set the panorama to SYDNEY on startup (when no panoramas have been
        // loaded which is when the savedInstanceState is null).
        // Convert to org.xms for HMS.
        org.xms.g.maps.StreetViewPanorama xmsStreetViewPanorama =
                 new org.xms.g.maps.StreetViewPanorama(null, panorama);
        if (savedInstanceState == null) {
            xmsStreetViewPanorama.setPosition(SYDNEY);
        }
    });
}
private void createAsG(final Bundle savedInstanceState) {
    Log.d(TAG, "create as gms");
    setContentView(R.layout.street_view_panorama_basic_demo);
    initMember();
    com.google.android.gms.maps.SupportStreetViewPanoramaFragment gStreetViewPanoramaFragment =
             (com.google.android.gms.maps.SupportStreetViewPanoramaFragment) getSupportFragmentManager().findFragmentById(R.id.streetviewpanorama);
    gStreetViewPanoramaFragment.getStreetViewPanoramaAsync(panorama -> {
        // Only set the panorama to SYDNEY on startup (when no panoramas have been
        // loaded which is when the savedInstanceState is null).
        // Convert HMS into org.xms.
        org.xms.g.maps.StreetViewPanorama xmsStreetViewPanorama =
                 new org.xms.g.maps.StreetViewPanorama(panorama, null);
        if (savedInstanceState == null) {
            xmsStreetViewPanorama.setPosition(SYDNEY);
        }
    });
}
private void initMember() {
 }

For details about how to call streeViewPanoramaFragment, please refer to the sample code to make adjustment.

Substitute Solutions for Certain Deprecated APIs

If Location Kit APIs are used in the To HMS API scenario, the Location dependency needs to be added. For details about the version number in ${version}, please refer to Version Change History of Location Kit.

implementation 'com.huawei.hms:location:${version}'

To use the Location function, ensure that you have obtained the location permission.

Sample code for obtaining the location permission:

/**
* only have permission of location, location function is enable
**/
if(enableMyLocation()){
    getMyLocation();
    setOnMyLocationChangeListener();
}
 /**
* Request code for location permission request.
*
* @see #onRequestPermissionsResult(int, String[], int[])
*/
private static final int LOCATION_PERMISSION_REQUEST_CODE = 1;
/**
* Enables the My Location layer if the fine location permission has been granted.
*/
private boolean enableMyLocation() {
    // Dynamically apply for the ACCESS_FINE_LOCATION permission.
    if (ContextCompat.checkSelfPermission(this,
            Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        // Permission to access the location is missing.
        PermissionUtils.requestPermission(this, LOCATION_PERMISSION_REQUEST_CODE,
                Manifest.permission.ACCESS_FINE_LOCATION, true);
        return false;
    }else {
        return true;
    }
}

[h2]HuaweiMap.getMyLocation()

This API can be replaced by the FusedLocationProviderClient.getLastLocation() method of Location Kit. For details about the API function, please refer to the getLastLocation() method in FusedLocationProviderClient of Location Kit.

To HMS API sample code:

// Current position.
private  android.location.Location myLocation;
/**
* this is an Example:
* using location kit getLastLocation ,replace HuaweiMap.getMylocation() function
*/
private void getMyLocation(){
   // Call the getLastLocation() method to obtain the last known location.
    com.huawei.hmf.tasks.Task<android.location.Location> locationTask =  LocationServices
            .getFusedLocationProviderClient(this).getLastLocation();
    // Define callback for success in requesting location updates.
    locationTask.addOnCompleteListener(param0 -> {
        if (locationTask != null) {
            // Obtain the latitude and longitude.
            myLocation = locationTask.getResult();
            double Lat = myLocation.getLatitude();
            double Lng = myLocation.getLongitude();
            Log.d(TAG, " Lat is : " + Lat +", Lng is : "+Lng);
        }// Define callback for failure in checking the device location settings.
    }).addOnFailureListener(param0 -> Log.d(TAG,"lastLocation is error"));
}

Add HMS API sample code:

//current location
private  android.location.Location myLocation;
/**
* this is an Example:
* using location kit getLastLocation ,replace HuaweiMap.getMylocation() function
*/
private void getMyLocation(){
   // Call the getLastLocation() method to obtain the last known location.
    org.xms.g.tasks.Task<android.location.Location> locationTask =  LocationServices
           .getFusedLocationProviderClient(this).getLastLocation();
    // Define callback for success in requesting location updates.
    locationTask.addOnCompleteListener(param0 -> {
        if (locationTask != null) {
            // Obtain the latitude and longitude.
            myLocation = locationTask.getResult();
            double Lat = myLocation.getLatitude();
            double Lng = myLocation.getLongitude();
            Log.d(TAG, " Lat is : " + Lat +", Lng is : "+Lng);
        }// Define callback for failure in checking the device location settings.
    }).addOnFailureListener(param0 -> Log.d(TAG,"lastLocation is error"));
}

[h2]HuaweiMap.setOnMyLocationListener()

This API can be replaced by the FusedLocationProviderClient.requestLocationUpdates(LocationRequest request, LocationCallback callback, Looper looper) method of Location Kit. For details about the API description, please refer to FusedLocationProviderClient.

To HMS API sample code:

/**
* this is an Example
* using location kit requestLocationUpdates(Request,LocationCallback,Looper) ,replace HuaweiMap.setOnMyLocationChangeListener()
*/
private void setOnMyLocationChangeListener(){
    // When you construct request parameters, please refer to the development guide of the Location Kit.
    // Set parameters for continuously requesting device locations.
    com.huawei.hms.location.LocationRequest request = new  com.huawei.hms.location.LocationRequest();
    // Set the location update interval (in milliseconds).
    request.setInterval(2000);
    // Call requestLocationUpdates() for continuous location.
    LocationServices
           .getFusedLocationProviderClient(this).requestLocationUpdates(request, new LocationCallback() {
        @Override
        public void onLocationResult(  com.huawei.hms.location.LocationResult locationResult) {
            if (locationResult != null) {
                // Process the location callback result.
                List<Location> locations = locationResult.getLocations();
                if (!locations.isEmpty()) {
                    for (Location location : locations) {
                        Log.i(TAG,
                                "onLocationResult location[Longitude,Latitude,Accuracy]:"
                                        + location.getLongitude() + "," + location.getLatitude() + ","
                                        + location.getAccuracy());
                    }
                }
            }
        }
        @Override
        public void onLocationAvailability(LocationAvailability locationAvailability) {
            if (locationAvailability != null) {
                // Check whether the locating is available.
                boolean flag = locationAvailability.isLocationAvailable();
                Log.i(TAG, "onLocationAvailability isLocationAvailable:" + flag);
            }
        }
    }, android.os.Looper.myLooper()).addOnSuccessListener(new OnSuccessListener<Void>() {
        @Override
        public void onSuccess(Void param0) {
            Log.d(TAG,"onSuccess.....");
        }
    });
}

Add HMS API sample code:

/**
* this is an Example
* using location kit requestLocationUpdates(Request,LocationCallback,Looper) ,replace HuaweiMap.setOnMyLocationChangeListener()
*/
private void setOnMyLocationChangeListener(){
      // When you construct request parameters, please refer to the development guide of Location Kit.
    org.xms.g.location.LocationRequest request = new  org.xms.g.location.LocationRequest();
     // Set the location update interval (in milliseconds).
    request.setInterval(2000);
    // Call requestLocationUpdates() for continuous location.
    LocationServices
            .getFusedLocationProviderClient(this).requestLocationUpdates(request, new LocationCallback() {
        @Override
        public void onLocationResult(  org.xms.g.location.LocationResult locationResult) {
            if (locationResult != null) {
                // Process the location callback result.
                List<Location> locations = locationResult.getLocations();
                if (!locations.isEmpty()) {
                    for (Location location : locations) {
                        Log.i(TAG,
                                "onLocationResult location[Longitude,Latitude,Accuracy]:"
                                        + location.getLongitude() + "," + location.getLatitude() + ","
                                        + location.getAccuracy());
                    }
                }
            }
        }
        @Override
        public void onLocationAvailability(LocationAvailability locationAvailability) {
            if (locationAvailability != null) {
                // Check whether the locating is available.
                boolean flag = locationAvailability.isLocationAvailable();
                Log.i(TAG, "onLocationAvailability isLocationAvailable:" + flag);
            }
        }
    }, android.os.Looper.myLooper()).addOnSuccessListener(new OnSuccessListener<Void>() {
        @Override
        public void onSuccess(Void param0) {
            Log.d(TAG,"onSuccess.....");
        }
    });
}

[h2]HuaweiMap.setOnCameraChangeListener()

This method can be replaced by the setOnCameraMoveStartedListener, setOnCameraMoveListener, and setOnCameraIdleListener methods for listening to the moveCamera event.

The sample code is as follows:

/**
* this is an Example
* using setOnCameraMoveStartedListener, setOnCameraMoveListener, setOnCameraIdleListener to
* replace to HuaweiMap.setOnCameraChangeListener.
*/
private void setOnCameraChangeListener() {
    Log.d(TAG, " start addMoveListener...");
    // Set a callback function, which is called when the camera starts to move.
    this.mMap.setOnCameraMoveStartedListener(i -> Log.d(TAG," start camera move..."));
    //Set a callback function to be repeatedly called when the camera is in motion state.
    this.mMap.setOnCameraMoveListener(() -> Log.d(TAG," camera moving..."));
    // Set a callback function called when the camera stops moving.
    this.mMap.setOnCameraIdleListener(() -> {
        Log.d(TAG," idle camera move... ");
    });
}

setMapStyle()

JSON resource files need to be loaded for map style settings (options: retro, night, grayscale, and simple). The JSON file format used by HuaweiMap is different from that used by Google Maps. As a result, they cannot share the same JSON resource file. Compatibility adaptation is required at the service code layer. To download the map style JSON files for HuaweiMap, please visit the download link.

[h2]Modification in the To HMS API Policy

  1. Download the Huawei JSON files.
  2. In the res/raw directory of the project (that is, the directory of the map style JSON resource files, which may vary according to projects), replace the resource files with those of the same names. The following figure shows the files for replacement.

[h2]Modification in the Add HMS API Policy

  1. Download the Huawei JSON files.
  2. Add mapstyle_grayscale_hms.json, mapstyle_night_hms.json, and mapstyle_retro_hms.json to the res/raw directory of the project (the directory may vary according to projects) as the map style resource files of Map Kit. These files coexist with the map style resource files of Google Maps. The following figure shows the files after the addition.

  3. The following is the sample code for Add HMS API compatibility after the modification. Load different JSON resource files based on system settings.
    private void setSelectedStyle() {
        MapStyleOptions style;
        switch (this.mSelectedStyleId) {
            case R.string.style_label_retro:
                // Sets the retro style via raw resource JSON.
                if(GlobalEnvSetting.isHms()){
                    style = MapStyleOptions.loadRawResourceStyle(this, R.raw.mapstyle_retro_hms);
                }else{
                    style = MapStyleOptions.loadRawResourceStyle(this, R.raw.mapstyle_retro);
                }
                break;
            case R.string.style_label_night:
                // Sets the night style via raw resource JSON.
                if(GlobalEnvSetting.isHms()){
                    style = MapStyleOptions.loadRawResourceStyle(this, R.raw.mapstyle_night_hms);
                }else{
                    style = MapStyleOptions.loadRawResourceStyle(this, R.raw.mapstyle_night);
                }
                break;
            case R.string.style_label_grayscale:
                // Sets the grayscale style via raw resource JSON.
                if(GlobalEnvSetting.isHms()){
                    style = MapStyleOptions.loadRawResourceStyle(this, R.raw.mapstyle_grayscale_hms);
                }else{
                    style = MapStyleOptions.loadRawResourceStyle(this, R.raw.mapstyle_grayscale);
                }
                break;
            case R.string.style_label_no_pois_no_transit:
                // Sets the no POIs or transit style via JSON string.
                style = new MapStyleOptions("[" + "  {" + "    \"featureType\":\"poi.business\","
                    + "    \"elementType\":\"all\"," + "    \"stylers\":[" + "      {"
                    + "        \"visibility\":\"off\"" + "      }" + "    ]" + "  }," + "  {"
                    + "    \"featureType\":\"transit\"," + "    \"elementType\":\"all\"," + "    \"stylers\":["
                    + "      {" + "        \"visibility\":\"off\"" + "      }" + "    ]" + "  }" + "]");
                break;
            case R.string.style_label_default:
                // Removes previously set style, by setting it to null.
                style = null;
                break;
            default:
                return;
        }
        // Set the basic map style. If this parameter is set to null, the previous customized style is cleared.
        this.mMap.setMapStyle(style);
    }