All Products
Search
Document Center

Configure startup page

Last Updated: Aug 24, 2021

Startup-page advertisement is also known as splash advertisement. The startup page, also called splash screen, is displayed after the application is started and the framework initialization is completed and disappeared when the application home page appears.

After configuring the startup page on the client, you can configure Splash booth information and advertising content on the console. For details, see Create a booth and Creating a marketing activity. It’s better to configure the fatigue control of the splash booth of the startup page as “disappeared after xx seconds”. The application obtains and displays the booth delivery data based on the configuration, and closes the page after xx seconds of the countdown. These steps realize the dynamic distribution and display of the delivery data.

Note: Due to the asynchronous process of downloading delivery data, only the download operation is performed for the first time after configuring the launch of the startup page in order not to block the launch of the application, the images are cached locally, and the cached images will be displayed the next time the application is started.

Based on the mPaaS framework, the timing and rationale of the startup page are as follows. For details about the mPaaS framework, see mPaaS framework introduction.

  1. After the framework started, the main thread creates and initializes LauncherActivityAgent, and opens the home page through the callback of LauncherActivityAgent.postInit.
  2. Check on the home page and open the startup page.

Examples

  1. Initialize the startup page in the home page.

    1. @Override
    2. protected void onCreate(Bundle savedInstanceState) {
    3. super.onCreate(savedInstanceState);
    4. // Home page logic
    5. // ........
    6. // ........
    7. // ........
    8. if (SplashActivity.checkIfSplashPrepared()) {
    9. startSplash();
    10. }
    11. }
    12. private void startSplash() {
    13. startActivity(new Intent(this, SplashActivity.class));
    14. overridePendingTransition(0, 0); // Remove the transition animation
    15. }
  2. Display the splash screen on the SplashActivity of the startup page.

    1. private void doSplash() {
    2. final CdpAdvertisementService cdpAdvertisementService = cpdService();
    3. cdpAdvertisementService.doSplash(this, new HashMap<String, String>(), new CdpAdvertisementService.IAdEventHandler() {
    4. @Override
    5. public void onClosed(SpaceInfo spaceInfo) {
    6. }
    7. @Override
    8. public void onJump(SpaceInfo spaceInfo) {
    9. // Redirect to the active target page
    10. }
    11. });
    12. }
    13. public static CdpAdvertisementService cpdService() {
    14. CdpAdvertisementService serviceByInterface = LauncherApplicationAgent.getInstance().getMicroApplicationContext().findServiceByInterface(
    15. CdpAdvertisementService.class.getName());
    16. return serviceByInterface;
    17. }