Configure startup page

更新时间:
复制 MD 格式

Startup page ads, also known as splash screen ads, appear after the application starts and the framework is initialized, and disappear when the home page loads.

After you configure the startup page on the client, you can configure Splash booth information and ad content in the console. For more information, see Create a booth and Create a campaign . Set the fatigue control for the startup page booth to 'Disappear after xx seconds'. The application retrieves and displays booth data based on this configuration, then closes the page after the countdown. This enables dynamic delivery and display of ad content.

Note

Because delivery data is downloaded asynchronously, the startup page does not block application startup. When delivery is configured, only the download runs initially and images are cached locally. The cached images are then displayed on the next application launch.

The startup page timing and behavior in the mPaaS framework are as follows:

  1. After the framework starts, the main thread creates and initializes LauncherActivityAgent. The LauncherActivityAgent.postInit callback method then opens the home page.

  2. The home page checks for and opens the startup page.

Usage example

  1. Initialize the startup page on the home page.

         @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
     }
  2. Display the startup page in SplashActivity.

     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) {
                 // Jump to the campaign target page
             }
         });
     }
    
     public static CdpAdvertisementService cpdService() {
         CdpAdvertisementService serviceByInterface = LauncherApplicationAgent.getInstance().getMicroApplicationContext().findServiceByInterface(
             CdpAdvertisementService.class.getName());
         return serviceByInterface;
     }