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.
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.
- After the framework started, the main thread creates and initializes
LauncherActivityAgent
, and opens the home page through the callback ofLauncherActivityAgent.postInit
. - Check on the home page and open the startup page.
Examples
Initialize the startup page in 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
}
Display the splash screen on the
SplashActivity
of the startup page.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;
}