Publishing rule management

更新时间:
复制 MD 格式

Resource configuration management is a fundamental feature of real-time publishing. It lets you predefine various configuration data required for real-time publishing. This saves you from manually entering the data each time, which improves efficiency and reduces errors.

This configuration data is also referred to as resources, such as cities or device models. When you add a configuration, the resource name is for display purposes, while the resource value is used to match the request parameter from the client.

On the resource configuration management page, you can add, modify, and delete resources.

Add a resource

  1. Log on to the mPaaS console. In the left navigation pane, choose Real-time Publishing > Publishing Rule Management to open the resource configuration list page.

    List

  2. On the resource configuration list page, click Add Resource. In the dialog box that appears, select the resource type and platform type, enter a resource name and resource value, and then click OK to create the resource.

    • Resource Type: The supported resource types are City, Device Model, Network, and Device OS Version.

    • Platform Type: Select a mobile platform. The options are Android, iOS, and All Platforms.

    • Resource Name: A custom name for display purposes. This name is usually the same as the resource value.

    • Resource Value: You can enter only one resource value at a time. The resource values for each type are described as follows:

      • City: The name of a prefecture-level city or a city of an equivalent administrative level. The name must include the administrative unit, such as City, Prefecture, Autonomous Prefecture, or League. For example, Shanghai City, Haidong Prefecture, Qiannan Buyei and Miao Autonomous Prefecture, and Hinggan League.

      • Device Model: The model of the mobile device, such as VIVO X5M or iPhone 6s.

      • Network: The network type, such as 2G, 3G, 4G, 5G, WIFI, or WWAN.

      • Device OS Version: The operating system version of the mobile device, such as 10.0.1 or 5.1.1.

      If you do not know the device model, network type, or device OS version, you can call an API to obtain this information from the mobile client. For more information, see Call an API to obtain resource configurations.

      Add

Modify a resource configuration

To modify a resource configuration, click Modify in the row of the resource. After you finish editing, click OK to save your changes.

Modify

Delete a resource

To delete a single resource, click Delete in the row of the resource. To delete multiple resources, select the checkboxes of the resources, click Batch Delete, and then confirm the deletion.

Delete

Call an API to get resource configurations

When you add a resource, if you do not know the specific resource values for the network type, device model, or device OS version, you can call the corresponding APIs to obtain this information.

Follow these steps:

  1. In your local project, call the following APIs to obtain information from the mobile client.

    • Android client

      DeviceInfo deviceInfo = DeviceInfo.createInstance(context);
      AppInfo appInfo = AppInfo.createInstance(context);
      
      deviceInfo.getOsVersion(); // Device OS version
      deviceInfo.getmMobileModel(); // Device model
      appInfo.getmProductVersion(); // Product version
      
      int networkType = NetworkUtils.getNetworkType(context); // Network type
      networkType = 1 (2G)
      networkType = 2 (3G)
      networkType = 3 (WIFI)
      networkType = 4 (4G)
    • iOS client

      Type

      Network

      Device OS Version (System API)

      Device Model (mPaaS Encapsulation API)

      Switch configuration

      None

      [[UIDevice currentDevice] systemVersion]

      • If the baseline version is earlier than 10.1.68.32, use [APMobileIdentifier shareIdentifier].deviceModel.

      • If the baseline version is 10.1.68.32 or later, use [MPaaSDVInfo sharedInstance].deviceModel.

      Upgrade check

      Wireless: WIFI, Mobile network: WWAN

      [[UIDevice currentDevice] systemVersion]

      • If the baseline version is earlier than 10.1.68.32, use [APMobileIdentifier shareIdentifier].deviceModel.

      • If the baseline version is 10.1.68.32 or later, use [MPaaSDVInfo sharedInstance].deviceModel.

      Hotpatching management, Offline package management, and Mini program management

      [DTReachability networkName]

      [[UIDevice currentDevice] systemVersion]

      • If the baseline version is earlier than 10.1.68.32, use [APMobileIdentifier shareIdentifier].deviceModel.

      • If the baseline version is 10.1.68.32 or later, use [MPaaSDVInfo sharedInstance].deviceModel.

  2. Report the client resource information to the server-side using logs. You can then view the corresponding resource configuration information on the server-side.