All Products
Search
Document Center

Mobile Platform as a Service:Configure app startup page

Last Updated:Jul 21, 2023

To deliver advertisements on the startup page of the app, namely the splash advertisements, you need to configure the startup page on the client.

The startup page is displayed after the application is started and the framework initialization is completed, and disappears when the application home page appears. The splash booth of the startup page is a special kind of preset booth. You need to configure the startup page through the client in advance, and then configure the advertising content of the splash booth of the page on the console.

How to configure the startup page is as follows.

Procedures

  1. Create an XML page for the startup page in the project, and create the SplashActivity class corresponding to the page at the same time.

  2. Initialize the startup page in the home page. In the MainActivity class, add the following codes for configuration:

     @Override
     protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      // Home page logic
      // ........
      // ........
      // ........
      if (SplashActivity.checkIfSplashPrepared()) {
          startSplash();
      }
     }
     private void startSplash() {
      startActivity(new Intent(this, SplashActivity.class));
      overridePendingTransition(0, 0); // Remove the transition animation
     }

    These steps will set a button on the home page of the application. Then you can call the startup page by clicking the button.

  3. Display the splash screen in the startup page. In the SplashActivity class, add the following codes for configuration:

     private void doSplash() {
         final CdpAdvertisementService cdpAdvertisementService = cpdService();
         cdpAdvertisementService.doSplash(this, new HashMap<String, String>(), new CdpAdvertisementService.IAdEventHandler() {
             @Override
              public void onClosed(SpaceInfo spaceInfo) {
             }
             @Override
             public void onJump(SpaceInfo spaceInfo) {
                 // Redirect to the active target page
             }
         });
     }
     public static CdpAdvertisementService cpdService() {
         CdpAdvertisementService serviceByInterface = LauncherApplicationAgent.getInstance().getMicroApplicationContext().findServiceByInterface(
             CdpAdvertisementService.class.getName());
         return serviceByInterface;
     }
  4. In the AndroidManifest file, add SplashActivity.

At this point, you have completed the startup page configuration.

Follow-up steps

After configuring the startup page on the client, you can create a splash booth for the startup page on the console for the purposes of creation and calls. For specific operations, see Create a splash booth.

Note that there can only be one startup-page splash booth in an application.