This topic describes the Mobile Content Delivery Platform (MCDP) related APIs and the startup page related APIs.
Delivery APIs
Delivery API class
The delivery API class is the unified entry point for delivery functions. You can call the operations in the class to implement the related MCDP functions.
@interface CDPPromotionInterface : NSObject
@end
Start component
API definition
+ (void)start;
API description
You can call this operation to start the MCDP component, including initializing all delivery data and pre-adding resource pictures.
Example
[CDPPromotionInterface start];
View MCDP component version
API definition
+ (NSString *)sdkVersion;
API description
You can call this operation to view the version number of the MCDP component.
Applicable versions: The API is available in version 3.0.0 and above.
Example
NSString cdpVersion = [CDPPromotionInterface sdkVersion];
Report advertisement sharing events.
API definition
+ (NSString *)reportShareAdAction;
API description
You can call this operation to report advertisement sharing events so that the sharing data can be displayed on the activity effect page of the MCDP console. The sharing data includes the sharing times and the number of sharing devices. The sharing times refers to the number of times that an advertisement is tapped and shared on the client page during a certain period of time. The number of devices with sharing operations refers to the total number of deduplicated devices on which the Share button is tapped on the client page during a certain period of time. For more information about advertisement sharing data, see View activity effect.
Applicable versions: The API is available in version 3.0.0 and above.
Example
CDPPromotionInterface reportShareAdAction];
Delivery properties
Configure delivery properties, including logon notification name, logout notification name, and whether to use positioning information.
Property definition
@interface CDPPromotionInterface : NSObject
//The following are subject to user's configuration.
@property (nonatomic, strong) NSString* loginNotificationName; // The logon notification name. This parameter has no default value.
@property (nonatomic, strong) NSString* logoutNotificationName; // The logout notification name. This parameter has no default value.
@property (nonatomic, assign) BOOL useLbsInfo; // Whether to use location information, the default is NO.
@end
Property description
Property | Type | Required | Description |
---|---|---|---|
loginNotificationName | NSString | No | The logon notification name. This parameter has no default value. MCDP will refresh the content delivered to the corresponding user according to the logon notification. |
logoutNotificationName | NSString | No | The name of the logout notification. This parameter has no default value. MCDP will clean up the cached delivery data according to the logout notification. |
useLbsInfo | BOOL | No | Whether to use location information inside MCDP, the default is NO, representing not to use location information. |
Example
[CDPPromotionInterface sharedInstance].loginNotificationName = @"xxxx";
Startup page APIs
MCDP provides a series of methods in C programming language to execute the logic related to the startup page, which includes:
Determine whether to display the startup page.
Open the startup page.
Send notification that the startup page will close.
Determine whether to display the startup page
API definition
BOOL splashScreenExist(BOOL shouldShowSplashScreen);
API description
Determine if the startup page needs to be displayed based on user-defined rules and MCDP internal rules.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
shouldShowSplashScreen | BOOL | Yes | Determine if the startup page needs to be displayed based on user-defined rules. |
Example
BOOL shouldShowSplash = YES;
// Whether to display advertisement on the startup page.
shouldShowSplash = splashScreenExist(shouldShowSplash);
Open the startup page
API definition
UIWindow * APSplashScreenStart(void (^dismiss)(void));
API description
Open the startup page and display the startup page advertisement.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
dismiss | block | Yes | Callback block of closing the startup page. |
Returned values
Parameter | Description |
---|---|
UIWindow | The created startup page window. |
Example
UIWindow *splashWindow = APSplashScreenStart(^{
// The callback of closing the startup page.
// Do something.
});
Send notification of startup page closing
API definition
void APWillKillSplashScreen(void);
API description
After the framework startup is loaded, notifies the framework that the startup page is about to close. After the notification, the startup page may not be closed immediately.
Example
APWillKillSplashScreen();