Dynamic environment switching lets you change the runtime environment of a debug build — switching between development, testing, and production configurations — without rebuilding the app. This feature requires mPaaS main integration baseline version 10.2.3.77 or later.
Prerequisites
Before you begin, make sure you have:
mPaaS main integration baseline version 10.2.3.77 or later
Add the dependency
implementation "com.mpaas.mocksettings:mocksettings-build:1.0.0.260514112908@aar"
Configure dynamic environment switching
-
Set up multi-environment configuration files.
Place the configuration files for each environment in the
assets/debug_envdirectory, as shown in the following image.NoteIf you skip this step, the system reads the configuration file from the main module by default.

-
Specify the runtime configuration file.
MockSettingsUtil.configName = "mpaas-debug.config" -
Configure Blue Shield images for multiple environments.
Store your Blue Shield images in the
assetsdirectory, each with a unique filename. Call the following API at runtime to specify which image to load.
MPBS.setBSAuthCodeDynamically(String bsAuthCode)API parameters
Parameter description:
bsAuthCodemust be the image filename without the file extension. For example, if the filename istest.jpg, passtest.Default value: If you do not call this API, the default image filename is
abs_1222.Constraint:
bsAuthCodecannot be an empty string.Multi-image handling: Generated images default to the name
abs_1222. To use separate images for different environments, rename each generated image before generating the next one to prevent files from being overwritten.