Skip to content

Instantly share code, notes, and snippets.

@MertCelik
Last active February 6, 2018 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MertCelik/6cbe44d4632d0ce38f48ee5e3f5aadf2 to your computer and use it in GitHub Desktop.
Save MertCelik/6cbe44d4632d0ce38f48ee5e3f5aadf2 to your computer and use it in GitHub Desktop.

Appmediation

SDK Setup

Import <appmediation/AMSDK.h> in your AppDelegate.m class and call SDK initialization method :

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [AMSDK initWithAppKey:@"your_app_key"];
}

Interstitial

Here is how you can integrate an interstitial into your app just in few steps;

  1. Import AMInterstitial on top of your class file:
#import<appmediation/AMInterstitial.h>
  1. Set your class to conform AMInterstitialDelegate :
@interface YourClass () <AMInterstitialDelegate>
  //code
@end
  1. Initialize and load the AMInterstitial instance :
self.interstitial = [[AMInterstitial alloc] init];
self.interstitial.delegate = self; // Optional
[self.interstitial load];
  1. Show when it's loaded :
if ([self.interstitial isReady]) {
  [self.interstitial presentFromViewController:self];
}
  1. (Optional) If you want to have a complete control over AMInterstitial instance, you can implement delegate functions below :
-(void)AMInterstitialDidLoad:(AMInterstitial *)interstitial;
-(void)AMInterstitialDidFailToLoad:(AMInterstitial *)interstitial withError:(NSError *)error;
-(void)AMInterstitialDidShow:(AMInterstitial *)interstitial;
-(void)AMInterstitialDidClick:(AMInterstitial *)interstitial;
-(void)AMInterstitialDidClose:(AMInterstitial *)interstitial;

Rewarded Video

Here is how you can integrate a rewarded video into your app just in few steps;

  1. Import AMRewarded on top of your class file:
#import<appmediation/AMRewarded.h>
  1. Set your class to conform AMRewardedDelegate :
@interface YourClass () <AMRewardedDelegate>
  //code
@end
  1. Initialize and load the AMRewarded instance :
self.rewarded = [[AMRewarded alloc] init];
self.rewarded.delegate = self; // Optional
[self.rewarded load];
  1. Show when it's loaded :
if ([self.rewarded isReady]) {
  [self.rewarded presentFromViewController:self];
}
  1. (Optional) If you want to have a complete control over AMRewarded instance, you can implement delegate functions below :
-(void)AMRewardedDidLoad:(AMRewarded  *)rewarded;
-(void)AMRewardedDidFailToLoad:(AMRewarded  *)rewarded withError:(NSError *)error;
-(void)AMRewardedDidShow:(AMRewarded  *)rewarded;
-(void)AMRewardedDidClick:(AMRewarded  *)rewarded;
-(void)AMRewardedDidClose:(AMRewarded  *)rewarded;
-(void)AMRewardedDidComplete:(AMRewarded *)rewarded withReward:(NSString *)name andAmount:(NSString *)amount;

Banner

Here is how you can integrate a banner into your app just in few steps;

  1. Import AMBanner on top of your class file:
#import<appmediation/AMBanner.h>
  1. Set your class to conform AMBannerDelegate :
@interface YourClass () <AMBannerDelegate>
  //code
@end
  1. Initialize and load AMBanner instance :
```objc
self.banner = [[AMBanner alloc] initWithSize:AMBanner_320x50 andPosition:Bottom];
//You can also use custom position, please refer to AMBanner header documentation.
self.banner.delegate = self; // Optional
[self.view addSubview:self.banner];
[self.banner load];
```
  1. To remove banner instance :
[self.banner remove];
  1. (Optional) If you want to have a complete control over AMBanner instance, you can implement delegate functions below :
-(void)AMBannerDidLoad:(AMRewarded  *)banner;
-(void)AMBannerDidFailToLoad:(AMRewarded  *)banner withError:(NSError *)error;
-(void)AMBannerDidShow:(AMRewarded  *)banner;
-(void)AMBannerDidClick:(AMRewarded  *)banner;

Advanced features

Please set these features before SDK initialization.

  1. Test Mode

    If you are testing your SDK integration, please set this value to display test ads and %100 fill. By default it is set to NO.

    [AMSDK setTestMode:YES];
  2. Logging

    Appmediation SDK supports 3 level of logging :

    • AMLogError : Only logs error messages. Set by default.
    • AMLogInfo : Logs information about setup.
    • AMLogDebug : Logs helpful information to debug.
    [AMSDK setLogLevel:AMLogDebug];
  3. Audience Targeting

    If you want to target specific audiences, you can set values below :

    3.1 Age

    [AMSDK setAge:20];

    3.2 Gender

    [AMSDK setGender:AppmediationUserGenderFemale];

    3.3 Language

    [AMSDK setLanguage:@"Chinese"];

    3.4 Keywords

    [AMSDK setKeywords:@"cars,technology"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment