As a developer, you can add switch configurations in the mPaaS console under Real-time Publishing > Configuration Switch Management. You can then publish these configurations to specific targets based on criteria such as platform, whitelist, percentage, version number, device model, or operating system version, including Android, iOS, and HarmonyOS NEXT.
Prerequisite
The SDK for the Switch Configuration Service is integrated into your Android, iOS, or HarmonyOS NEXT client.
Add switch configurations
You can add switch configurations individually or import multiple configurations at once from a JSON file.
The switch configuration list displays the configuration key, status, creation time, update time, creator, and modifier for each switch configuration. New switch configurations are active by default.
Add individually
In the mPaaS console, follow these steps:
In the left navigation pane, click Real-time Publishing > Configuration Switch Management.
Click Add Configuration. On the New Configuration page, enter a configuration key, remarks, and resource value, and then select the platform and classification. A configuration key can have multiple resource values. To add more resource values, click the Add button.
Add advanced rules (optional). In the resource value configuration box, click Add next to Advanced Rules. Select a resource type, such as version number, operating system version, device model, or city. Then, select an operation type and set the resource value. You can add multiple advanced rules for each resource value.
When you are finished, click Done. The new switch configuration appears in the configuration list.
Import in batches
On the Configuration Switch Management page, click More Operations > Import File above the configuration list to import a switch configuration file in JSON format. This file can contain multiple switch configurations. After a successful import, the imported configurations appear in the configuration list.
If a switch configuration in the file already exists, that configuration cannot be imported.
The real-time publishing platform also lets you export configurations. On the Configuration Switch Management page, click More Operations > Export Configuration above the configuration list. Select the configurations to export, and then click Export Configuration to download the JSON configuration file.
Query switch configurations
On the Configuration Switch Management page, enter a keyword for a configuration key to query switch configurations.
Modify a switch configuration
To modify a switch configuration, follow these steps:
On the Configuration Switch Management page, select the target configuration and click the configuration key to open the edit page.
Modify the remarks, resource value, platform, classification, or advanced rules, and then click Done. You cannot modify the configuration key after it has been added.
Activate or deactivate a switch
New switch configurations are active by default. If you no longer need a configuration, click Deactivate to make it inactive. To reactivate an inactive configuration, click Activate.
What to do next
After you publish a switch in the console, the client can call an API to retrieve the key-value pair for the switch. For more information, see Integrate with HarmonyOS NEXT.