All Products
Search
Document Center

Configure a preset center booth

Last Updated: Aug 24, 2021

Special booth positions such as the middle cannot be configured through the mPaaS console. To create such booths, you need preset the booth on the client page through codes to control the booth page, position, and other attributes.

The following describes how to configure a preset booth situated in the middle by client coding.

Procedures

  1. In the project, create an app page that will be used for advertising and its corresponding category, such as AdvertisementBoothActivity. A preset booth will be configured in the middle of the page through the client code. 1
  2. Preset the CdpAdvertisementView parameter to the app page created in Step 1 by any of the following methods.

    • Preset the CdpAdvertisementView parameter through XML:
      1. <com.mpaas.cdp.CdpAdvertisementView
      2. android:id="@+id/pit_cdp_cav"
      3. android:layout_width="match_parent"
      4. android:layout_height="150px"
      5. android:layout_marginTop="800px"
      6. android:background="#66ccff"
      7. />
    • Add the CdpAdvertisementView parameter through Java:

      1. CdpAdvertisementView cdpView = new CdpAdvertisementView(context);
      2. parentView.addView(cdpView);
  3. Call the update API in the onResume() life cycle of the corresponding Activity to obtain other information about the booth from the server, such as booth height, display style, and content type.
    1. cdpView.updateSpaceCode("my_space_code"); //Replace my_space_code with booth ID
    3
    Note: After completing the corresponding booth configuration on the console, the booth information obtained from the server will be populated into the CdpAdvertisementView parameter.
  4. In the AndroidManifest file, add AdvertisementBoothActivity.

    1

At this point, you have completed the configuration of a preset booth.

What to do next

After configuring the booth ID, booth page, booth position and other attributes on the client, you can create the corresponding booth on the console (the preset booth ID created on the console must be consistent with that on the client) for use in an activity. For details, see Create a client preset booth.