All Products
Search
Document Center

Configure app startup page

Last Updated: Aug 24, 2021

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.

    1

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

    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. }

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

    Startup page configuration1

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

    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. }

    2

  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.