-
Notifications
You must be signed in to change notification settings - Fork 2
API Reference (EN)
+ sdkVersion
+ startWithMediaId:delegate:
+ setAdTestMode:
+ setDelegate:
+ canShow
+ canShowAtZoneId:
+ show DEPRECATED
+ showAtZoneId: DEPRECATED
Advanced
+ startWithNonDefaultMediaId:delegate:
+ showWithViewController:
+ showAtZoneId:vc:
- maioDidInitialize
- maioDidChangeCanShow:newValue:
- maioWillStartAd:
- maioDidFinishAd:playtime:skipped:rewardParam:
- maioDidClickAd:
- maioDidCloseAd:
- maioDidFail:reason:
Advanced
mediaId
adTestMode
delegate
- canShow
- canShowAtZoneId:
- show DEPRECATED
- showAtZoneId: DEPRECATED
- showWithViewController:
- showAtZoneId:vc:
Get maio SDK version number.
v1.0.7+
+ (NSString *)sdkVersion
Initialize the SDK.
+ (void)startWithMediaId:(NSString *)mediaId delegate:(id<MaioDelegate>)delegate
-
mediaId
The mediaid generated for your application located in the maio dashboard
-
delegate
Delegates to capture SDK events. Use nil if you dont want to capture events.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Set SDK to test mode.
[Maio setAdTestMode:YES];
// Start maio SDK initilization.
[Maio startWithMediaId:MAIO_MEDIA_ID delegate:nil];
return YES;
}
Returns SDK test mode setting.
+ (void)setAdTestMode:(BOOL)adTestMode
-
adTestMode
To run the SDK in test mode use YES, otherwise use NO. Set test mode to
YES
while developing your app andNO
once released to Play Store (default value isNO
).
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Sets SDK to test mode
[Maio setAdTestMode:YES];
// SDK initialize
[Maio startWithMediaId:MAIO_MEDIA_ID delegate:nil];
return YES;
}
Set delegate to capture SDK events.
+ (void)setDelegate:(id<MaioDelegate>)delegate
-
delegate
Delegate to capture SDK events
Default zone is ready to show a video ad YES
is returned, else NO
is returned.
+ (BOOL)canShow
- (IBAction)onOpenAd:(id)sender {
// Display video ad
if ([Maio canShow]) {
[Maio showWithViewController:self];
}
}
Specified zone is ready to show a video ad YES
is returned, else NO
is returned.
+ (BOOL)canShowAtZoneId:(NSString *)zoneId
-
zoneId
ZoneId of the zone you want to display a video ad for.
- (IBAction)onOpenAd:(id)sender {
// Display video ad
if ([Maio canShowAtZoneId:ZONE_ID]) {
[Maio showAtZoneId:MAIO_ZONE_ID vc:self];
}
}
Display video ad for default zone.
*Deprecated from v1.5.0. Use showWithViewController:
.
+ (void)show
Display video ad for specified zone.
*Deprecated from v1.5.0. Use showAtZoneId:vc:
.
+ (void)showAtZoneId:(NSString *)zoneId
-
zoneId
ZoneId of the zone you want to display a video ad for.
Advanced
Initialize maio MediaId with a different mediaId (Multiple mediaIds).
Mainly used when using maio via a third party library.
v1.1.0+
+ (MaioInstance *)startWithNonDefaultMediaId:(NSString *)mediaEid delegate:(id<MaioDelegate>)delegate
-
mediaId
The mediaid generated for your application located in the maio dashboard
-
delegate
Delegates to capture SDK events. Use nil if you dont want to capture events.
Advanced
Explicitly choose which UIViewController to display video ad for default zone.
v1.0.1+
+ (void)showWithViewController:(UIViewController *)vc;
-
vc
UIViewController instance
- (IBAction)onOpenAd:(id)sender {
// Display video ad
if ([Maio canShow]) {
[Maio showWithViewController:self];
}
}
Advanced
Explicitly choose which UIViewController to display video ad for specified zone.
v1.0.1+
+ (void)showAtZoneId:(NSString *)zoneEid vc:(UIViewController *)vc;
-
zoneId
ZoneId of the zone you want to display a video ad for.
-
vc
UIViewController instance
- (IBAction)onOpenAd:(id)sender {
// Display video ad
if ([Maio canShowAtZoneId:ZONE_ID]) {
[Maio showAtZoneId:MAIO_ZONE_ID vc:self];
}
}
Called when SDK has inititialized.
- (void)maioDidInitialize
Called when SDK status change from Can Show video to Cannot Show Video event.
- (void)maioDidChangeCanShow:(NSString *)zoneId newValue:(BOOL)newValue
-
zoneId
Status changed zoneId
-
newValue
Current Status.
YES
= Can Show VideoNO
= Cannot Show Video
- (void)maioDidChangeCanShow:(NSString *)zoneId newValue:(BOOL)newValue {
// Toggle buttons validy property depending on whether ads are available or not.
if ([ZONE_ID isEqualToString:zoneId]) {
self.startButton.enabled = newValue;
}
else if ([ZONE_ID_2 isEqualToString:zoneId]) {
self.start2Button.enabled = newValue;
}
}
Called when video is about to play. Only called once, not called on replays.
- (void)maioWillStartAd:(NSString *)zoneId
-
zoneId
ZoneId for ad being played
Called when video finished playing. Only called once, not called on replays.
- (void)maioDidFinishAd:(NSString *)zoneId playtime:(NSInteger)playtime skipped:(BOOL)skipped rewardParam:(NSString *)rewardParam
-
zoneId
ZoneId for ad being played
-
playtime
Amount of seconds video was actually played
-
skipped
If video was skipped
YES
elseNO
-
rewardParam
Reward parameter (when ad type is Reward Video)
- (void)maioDidFinishAd:(NSString *)zoneId playtime:(NSInteger)playtime skipped:(BOOL)skipped rewardParam:(NSString *)rewardParam {
// TODO: Code to give reward
}
Called when end card is clicked.
- (void)maioDidClickAd:(NSString *)zoneId
-
zoneId
ZoneId for ad being clicked
Called when the ad is closed.
- (void)maioDidCloseAd:(NSString *)zoneId
-
zoneId
ZoneId for closed ad
Called when there is an SDK error.
- (void)maioDidFail:(NSString *)zoneId reason:(MaioFailReason)reason
-
zoneId
ZoneId that caused error Sometimes nil will be returned if there is no zone, or a network error.
-
reason
Reason for error
maio SDK error types
-
MaioFailReasonAdStockOut
Ads out of stock
-
MaioFailReasonNetworkConnection
Network connection error
-
MaioFailReasonNetworkClient
HTTP status 4xx client error
-
MaioFailReasonNetworkServer
HTTP status 5xx server error
-
MaioFailReasonSdk
SDK Error
-
MaioFailReasonDownloadCancelled
Creative download cancelled
-
MaioFailReasonVideoPlayback
Video playback error
-
MaioFailReasonUnknown
Unknown error
Advanced
v1.1.0+
Returns maio MediaId
@property (nonatomic, readonly) NSString *mediaId
Returns SDK test mode setting.
@property (nonatomic) BOOL adTestMode
Returns maio SDK delegate
@property (nonatomic) id<MaioDelegate> delegate
- (BOOL)canShow
- (BOOL)canShowAtZoneId:(NSString *)zoneId
*Deprecated from v1.5.0. Use showWithViewController:
.
- (void)show
*Deprecated from v1.5.0. Use showAtZoneId:vc:
.
- (void)showAtZoneId:(NSString *)zoneId
- (void)showWithViewController:(UIViewController *)vc;
- (void)showAtZoneId:(NSString *)zoneEid vc:(UIViewController *)vc;