![]() iOS SDK v1.6 |
![]() Swift SDK v1.6 |
![]() iOS Unity Plugin v1.6 |
![]() iOS Cocos2d-x v1.6 |
![]() iOS Cocos2d-iPhone v1.6 |
![]() Buzztouch v1.6 |
![]()
Android SDK v1.6 |
![]() Android Unity Plugin v1.6 |
![]() Buzztouch v1.6 |
Open your Unity project -> Double click AdTapsy-Unity-Plugin.unitypackage -> Click "Import" button
In your game initialization you need to start session with the method
AdTapsy.StartSessionIOS("ADTAPSY_APP_ID");
void Start () {
//...
AdTapsy.StartSessionIOS("ADTAPSY_APP_ID");
//...
}
Use the method
AdTapsy.ShowInterstitial()
at places where you want to show ads. Such places can be on game start,
after the game become active, on game pauses, etc.
void Start () {
AdTapsy.ShowInterstitial();
}
void ShowInterstitial() {
if (AdTapsy.isAdReadyToShow()) {
UnityEngine.Debug.Log("Ad is ready to be shown");
AdTapsy.ShowInterstitial();
} else {
UnityEngine.Debug.Log("Ad is not ready to be shown");
}
}
void OnApplicationPause(bool pauseStatus) {
if (!pauseStatus) {
AdTapsy.ShowInterstitial();
}
}
Use the method
AdTapsy.ShowRewardedVideo()
at places where you want to show rewarded video ads.
void ShowRewardedVideo() {
if (AdTapsy.IsRewardedVideoReadyToShow ()) {
UnityEngine.Debug.Log("Ad is ready to be shown");
AdTapsy.ShowRewardedVideo();
} else {
UnityEngine.Debug.Log("Ad is not ready to be shown");
}
}
In Unity select File -> Build & Run -> Select iOS -> Build And Run
This will run XCode and open Unity-iPhone project
If you updating from an old AdTapsy SDK or if you have an old SDK versions of ad networks already bundled in AdTapsy, please remove them before adding the new one.
Choose "Copy items into destination group's folder" and click Finish
Vungle SDK is not included in the bundle, if you want to use Vungle ads please download it and copy VungleSDK.embeddedframework to your project https://v.vungle.com/dev/ios
Click Project -> Build Settings -> Search for other linker flags -> Add -ObjC like on screenshot
If your project is not using ARC, please add -fobjc-arc flag to be able to compile AdTapsy and ad networks SDKs.
Add required frameworks in Project options -> Active target -> Build Phases -> Link Binary With Libraries
StoreKit.framework (Required)
WebKit.framework (Required)
WatchConnectivity.framework (Required)
EventKit.framework (Required)
EventKitUI.framework (Required)
CoreData.framework (Required)
CoreMedia.framework (Required)
AudioToolbox.framework (Required)
AVFoundation.framework (Required)
CFNetwork.framework (Required)
CoreAudio.framework (Required)
CoreLocation.framework (Required)
CoreTelephony.framework (Required)
MediaPlayer.framework (Required)
MessageUI.framework (Required)
QuartzCore.framework (Required)
Security.framework (Required)
SystemConfiguration.framework (Required)
CoreGraphics.framework (Required)
UIKit.framework (Required)
Foundation.framework (Required)
libsqlite.3.0.tbd (Required)
libz.tbd (Required)
Social.framework (Optional)
StoreKit.framework (Optional)
WebKit.framework (Optional)
AdSupport.framework (Optional)
CoreBluetooth.framework (Optional)
Some of the frameworks are set to optional if you build for older iOS versions.
AdTapsy is compliant with ATS, however some of the ad networks still do not have compliant version of their SDK. It is recommended to disable ATS for now to have good fill rate from all ad networks. Add this code to your Info.plist file:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
More for iOS 9 Support
AdTapsy SDK requires that publishers set a flag indicating whether
a user located in the European Union (i.e., EU/GDPR data subject)
has provided opt-in consent for the collection and use of personal data.
The consent is passed to all enabled ad networks SDKs, if consent is not granted by user, then ad networks will not show targeted ads, collect/process personal data, etc.
Call this methods before initialize AdTapsy.
AdTapsy.SetUserSubjectToGdpr(boolean); // true by default
AdTapsy.SetConsentGrantedGdpr(boolean); // false by default
If the user is non EU citizen:
AdTapsy.SetUserSubjectToGdpr(false);
If the user is EU citizen (i.e., EU/GDPR data subject) and consent granted:
AdTapsy.setUserSubjectToGdpr(true);
AdTapsy.SetConsentGrantedGdpr(true);
If the user is EU citizen (i.e., EU/GDPR data subject) and consent not granted or declined:
AdTapsy.setUserSubjectToGdpr(true);
AdTapsy.SetConsentGrantedGdpr(false);
Now your project should build successfully and run.
Unity generates XCode project with wrong configuration. In Library Search Paths "$(SRCROOT)/Libraries" should be without quotes.
Project Settings -> Build Settings -> Library Search Paths -> Remove quotes from $(SRCROOT)/Libraries
Runtime error when run from XCode
"You are using Unity iPhone Basic. You are not allowed to remove the Unity splash screen from your game."
More info here
Check this video how to link Unity and XCode and fix the issue.
Click here for Advanced Integration (Optional)AdTapsy.SetRewardedVideoAmount (10);
If you are using server-side callbacks, you must set the user identifier
AdTapsy.SetUserIdentifier ("user1");
If you want to use the networks default popups for rewarded video you can enable them
AdTapsy.SetRewardedVideoPrePopupEnabled (false);
AdTapsy.SetRewardedVideoPostPopupEnabled (false);
void Start ()
{
AdTapsy.OnAdCached += delegate(int zoneId) {
if(zoneId == AdTapsy.InterstitialZone){
UnityEngine.Debug.Log("***AdTapsy cached interstitial ad***");
} else if(zoneId == AdTapsy.RewardedVideoZone){
UnityEngine.Debug.Log("***AdTapsy cached rewarded ad***");
}
};
AdTapsy.OnAdShown += delegate(int zoneId){
if(zoneId == AdTapsy.InterstitialZone){
UnityEngine.Debug.Log("***AdTapsy showed interstitial ad***");
} else if(zoneId == AdTapsy.RewardedVideoZone){
UnityEngine.Debug.Log("***AdTapsy showed rewarded ad***");
}
};
AdTapsy.OnAdSkipped += delegate(int zoneId){
if(zoneId == AdTapsy.InterstitialZone){
UnityEngine.Debug.Log("***AdTapsy skipped interstitial ad***");
} else if(zoneId == AdTapsy.RewardedVideoZone){
UnityEngine.Debug.Log("***AdTapsy skipped rewarded ad***");
}
};
AdTapsy.OnAdFailedToShow += delegate(int zoneId) {
if(zoneId == AdTapsy.InterstitialZone){
UnityEngine.Debug.Log("***AdTapsy failed to show interstitial ad***");
} else if(zoneId == AdTapsy.RewardedVideoZone){
UnityEngine.Debug.Log("***AdTapsy failed to show rewarded ad***");
}
};
AdTapsy.OnAdClicked += delegate(int zoneId) {
if(zoneId == AdTapsy.InterstitialZone){
UnityEngine.Debug.Log("***AdTapsy clicked interstitial ad***");
} else if(zoneId == AdTapsy.RewardedVideoZone){
UnityEngine.Debug.Log("***AdTapsy clicked rewarded ad***");
}
};
AdTapsy.OnRewardEarned += delegate(int amount){
UnityEngine.Debug.Log("***AdTapsy reward earned " + amount + "***");
};
}
void Start ()
{
AdTapsy.SetTestMode (true, "Simulator", "Google Device ID");
}
Note: Disable before publish on App Store.
If you updating from an old AdTapsy SDK or if you have an old SDK versions of ad networks already bundled in AdTapsy, please remove them before adding the new one.
Choose "Copy items into destination group's folder" and click Finish
Vungle SDK is not included in the bundle, if you want to use Vungle ads please download it and copy VungleSDK.embeddedframework to your project https://v.vungle.com/dev/ios
Click Project -> Build Settings -> Search for other linker flags -> Add -ObjC like on screenshot
If your project is not using ARC, please add -fobjc-arc flag to be able to compile AdTapsy and ad networks SDKs.
Add required frameworks in Project options -> Active target -> Build Phases -> Link Binary With Libraries
StoreKit.framework (Required)
WebKit.framework (Required)
WatchConnectivity.framework (Required)
EventKit.framework (Required)
EventKitUI.framework (Required)
CoreData.framework (Required)
CoreMedia.framework (Required)
AudioToolbox.framework (Required)
AVFoundation.framework (Required)
CFNetwork.framework (Required)
CoreAudio.framework (Required)
CoreLocation.framework (Required)
CoreTelephony.framework (Required)
MediaPlayer.framework (Required)
MessageUI.framework (Required)
QuartzCore.framework (Required)
Security.framework (Required)
SystemConfiguration.framework (Required)
CoreGraphics.framework (Required)
UIKit.framework (Required)
Foundation.framework (Required)
libsqlite.3.0.tbd (Required)
libz.tbd (Required)
Social.framework (Optional)
StoreKit.framework (Optional)
WebKit.framework (Optional)
AdSupport.framework (Optional)
CoreBluetooth.framework (Optional)
Some of the frameworks are set to optional if you build for older iOS versions.
AdTapsy is compliant with ATS, however some of the ad networks still do not have compliant version of their SDK. It is recommended to disable ATS for now to have good fill rate from all ad networks. Add this code to your Info.plist file:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
More for iOS 9 Support
// AppDelegate.mm
#import "AdTapsy.h"
bool AppDelegate::applicationDidFinishLaunching() {
[AdTapsy startSession:@"ADTAPSY_APP_ID"];
}
// AppDelegate.mm
#import "AdTapsy.h"
void AppDelegate::start() {
UIViewController * viewController = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
[AdTapsy showInterstitial: viewController];
}
// GameOver.mm
void GameOver::showInterstitial() {
if ([AdTapsy isInterstitialReadyToShow]) {
NSLog(@"Ad is ready be shown");
UIViewController * viewController = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
[AdTapsy showInterstitial: viewController];
} else {
NSLog(@"Ad is not ready to be shown");
}
}
When you want to show interstitial ad, use the code
[AdTapsy showInterstitial: viewController];
Note: You need to pass active View Controller as parameter. Getting the active View Controller depends on your code. Check some examples::
When you want to show rewarded video ad, use the code
[AdTapsy showRewardedVideo: viewController];
// GameStore.mm
void GameStore::showRewardedVideo() {
if ([AdTapsy isRewardedVideoReadyToShow]) {
NSLog(@"Ad is ready be shown");
UIViewController * viewController = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
[AdTapsy showRewardedVideo: viewController];
} else {
NSLog(@"Ad is not ready to be shown");
}
}
AdTapsy SDK requires that publishers set a flag indicating whether
a user located in the European Union (i.e., EU/GDPR data subject)
has provided opt-in consent for the collection and use of personal data.
The consent is passed to all enabled ad networks SDKs, if consent is not granted by user, then ad networks will not show targeted ads, collect/process personal data, etc.
Call this methods before initialize AdTapsy.
[AdTapsy setUserSubjectToGdpr: (BOOL)]; // YES by default
[AdTapsy setConsentGrantedGdpr: (BOOL)]; // NO by default
If the user is non EU citizen:
[AdTapsy setUserSubjectToGdpr: NO];
If the user is EU citizen (i.e., EU/GDPR data subject) and consent granted:
[AdTapsy setUserSubjectToGdpr: YES];
[AdTapsy setConsentGrantedGdpr: YES];
If the user is EU citizen (i.e., EU/GDPR data subject) and consent not granted or declined:
[AdTapsy setUserSubjectToGdpr: YES];
[AdTapsy setConsentGrantedGdpr: NO];
Now your project should build successfully and run.
Click here for Advanced Integration (Optional)[AdTapsy setRewardedVideoAmount:10];
If you are using server-side callbacks, you must set the user identifier
[AdTapsy setUserIdentifier: @"user1"];
If you want to use the networks default popups for rewarded video you can enable them
[AdTapsy setRewardedVideoPrePopupEnabled: YES];
[AdTapsy setRewardedVideoPostPopupEnabled: YES];
//
// ViewController.h
//
#import "AdTapsy.h"
@interface ViewController : UIViewController<ATLogDelegate, AdTapsyDelegate>
@end
Then in your implementation in the init method pass delegate object to AdTapsy and implement callback methods.
//
// ViewController.m
//
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[AdTapsy setDelegate: self];
}
-(void)adtapsyDidCachedInterstitialAd {
NSLog(@"***adtapsyDidCachedInterstitialAd***");
}
-(void)adtapsyDidCachedRewardedVideoAd {
NSLog(@"***adtapsyDidCachedRewardedVideoAd***");
}
-(void)adtapsyDidClickedInterstitialAd {
NSLog(@"***adtapsyDidClickedInterstitialAd***");
}
-(void)adtapsyDidClickedRewardedVideoAd {
NSLog(@"***adtapsyDidClickedRewardedVideoAd***");
}
-(void)adtapsyDidFailedToShowInterstitialAd {
NSLog(@"***adtapsyDidFailedToShowInterstitialAd***");
}
-(void)adtapsyDidFailedToShowRewardedVideoAd {
NSLog(@"***adtapsyDidFailedToShowRewardedVideoAd***");
}
-(void)adtapsyDidShowInterstitialAd {
NSLog(@"***adtapsyDidShowInterstitialAd***");
}
-(void)adtapsyDidShowRewardedVideoAd {
NSLog(@"***adtapsyDidShowRewardedVideoAd***");
}
-(void)adtapsyDidSkippedInterstitialAd {
NSLog(@"***adtapsyDidSkippedInterstitialAd***");
}
-(void)adtapsyDidSkippedRewardedVideoAd {
NSLog(@"***adtapsyDidSkippedRewardedVideoAd***");
}
-(void)adtapsyDidEarnedReward:(BOOL)success andAmount:(int)amount {
NSLog(@"***adtapsyDidEarnedReward*** success: %d amount %d", success, amount);
}
@end
[AdTapsy setTestMode:YES andTestDevices: @[ @"Simulator", @"Google device ID" ]];
Note: Disable before publish on App Store.
If you updating from an old AdTapsy SDK or if you have an old SDK versions of ad networks already bundled in AdTapsy, please remove them before adding the new one.
Choose "Copy items into destination group's folder" and click Finish
Vungle SDK is not included in the bundle, if you want to use Vungle ads please download it and copy VungleSDK.embeddedframework to your project https://v.vungle.com/dev/ios
Click Project -> Build Settings -> Search for other linker flags -> Add -ObjC like on screenshot
If your project is not using ARC, please add -fobjc-arc flag to be able to compile AdTapsy and ad networks SDKs.
Add required frameworks in Project options -> Active target -> Build Phases -> Link Binary With Libraries
StoreKit.framework (Required)
WebKit.framework (Required)
WatchConnectivity.framework (Required)
EventKit.framework (Required)
EventKitUI.framework (Required)
CoreData.framework (Required)
CoreMedia.framework (Required)
AudioToolbox.framework (Required)
AVFoundation.framework (Required)
CFNetwork.framework (Required)
CoreAudio.framework (Required)
CoreLocation.framework (Required)
CoreTelephony.framework (Required)
MediaPlayer.framework (Required)
MessageUI.framework (Required)
QuartzCore.framework (Required)
Security.framework (Required)
SystemConfiguration.framework (Required)
CoreGraphics.framework (Required)
UIKit.framework (Required)
Foundation.framework (Required)
libsqlite.3.0.tbd (Required)
libz.tbd (Required)
Social.framework (Optional)
StoreKit.framework (Optional)
WebKit.framework (Optional)
AdSupport.framework (Optional)
CoreBluetooth.framework (Optional)
Some of the frameworks are set to optional if you build for older iOS versions.
AdTapsy is compliant with ATS, however some of the ad networks still do not have compliant version of their SDK. It is recommended to disable ATS for now to have good fill rate from all ad networks. Add this code to your Info.plist file:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
More for iOS 9 Support
Import
AdTapsy.h
in
AppDelegate.m
and start session with
[AdTapsy startSession:@"ADTAPSY_APP_ID"];
in
didFinishLaunchingWithOptions
method
#import "AppDelegate.h"
#import "AdTapsy.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Start AdTapsy session
[AdTapsy startSession: @"ADTAPSY_APP_ID"];
return YES;
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Destroy on terminate
[AdTapsy destroy];
}
@end
#import "AdTapsy.h"
@implementation GameScene
-(void) showAd {
UIViewController *rootViewController = (UIViewController *)[[[CCDirector sharedDirector] openGLView] nextResponder];
[AdTapsy showInterstitial: rootViewController];
}
// GameOver.m
-(void) showInterstitial() {
if ([AdTapsy isInterstitialReadyToShow]) {
NSLog(@"Ad is ready be shown");
UIViewController *rootViewController = (UIViewController *)[[[CCDirector sharedDirector] openGLView] nextResponder];
[AdTapsy showInterstitial:rootViewController];
} else {
NSLog(@"Ad is not ready to be shown");
}
}
When you want to show interstitial ad, use the code
[AdTapsy showInterstitial: viewController];
Note: You need to pass active View Controller as parameter. Getting the active View Controller depends on your code. Check some examples::
When you want to show rewarded video ad, use the code
[AdTapsy showRewardedVideo: viewController];
#import "AdTapsy.h"
@implementation GameScene
-(void) showAd {
UIViewController *rootViewController = (UIViewController *)[[[CCDirector sharedDirector] openGLView] nextResponder];
[AdTapsy showInterstitial: rootViewController];
}
// GameOver.m
-(void) showRewardedVideo() {
if ([AdTapsy isRewardedVideoReadyToShow]) {
NSLog(@"Ad is ready be shown");
UIViewController *rootViewController = (UIViewController *)[[[CCDirector sharedDirector] openGLView] nextResponder];
[AdTapsy showRewardedVideo:rootViewController];
} else {
NSLog(@"Ad is not ready to be shown");
}
}
AdTapsy SDK requires that publishers set a flag indicating whether
a user located in the European Union (i.e., EU/GDPR data subject)
has provided opt-in consent for the collection and use of personal data.
The consent is passed to all enabled ad networks SDKs, if consent is not granted by user, then ad networks will not show targeted ads, collect/process personal data, etc.
Call this methods before initialize AdTapsy.
[AdTapsy setUserSubjectToGdpr: (BOOL)]; // YES by default
[AdTapsy setConsentGrantedGdpr: (BOOL)]; // NO by default
If the user is non EU citizen:
[AdTapsy setUserSubjectToGdpr: NO];
If the user is EU citizen (i.e., EU/GDPR data subject) and consent granted:
[AdTapsy setUserSubjectToGdpr: YES];
[AdTapsy setConsentGrantedGdpr: YES];
If the user is EU citizen (i.e., EU/GDPR data subject) and consent not granted or declined:
[AdTapsy setUserSubjectToGdpr: YES];
[AdTapsy setConsentGrantedGdpr: NO];
Now your project should build successfully and run.
Click here for Advanced Integration (Optional)[AdTapsy setRewardedVideoAmount:10];
If you are using server-side callbacks, you must set the user identifier
[AdTapsy setUserIdentifier: @"user1"];
If you want to use the networks default popups for rewarded video you can enable them
[AdTapsy setRewardedVideoPrePopupEnabled: YES];
[AdTapsy setRewardedVideoPostPopupEnabled: YES];
//
// ViewController.h
//
#import "AdTapsy.h"
@interface ViewController : UIViewController<ATLogDelegate, AdTapsyDelegate>
@end
Then in your implementation in the init method pass delegate object to AdTapsy and implement callback methods.
//
// ViewController.m
//
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[AdTapsy setDelegate: self];
}
-(void)adtapsyDidCachedInterstitialAd {
NSLog(@"***adtapsyDidCachedInterstitialAd***");
}
-(void)adtapsyDidCachedRewardedVideoAd {
NSLog(@"***adtapsyDidCachedRewardedVideoAd***");
}
-(void)adtapsyDidClickedInterstitialAd {
NSLog(@"***adtapsyDidClickedInterstitialAd***");
}
-(void)adtapsyDidClickedRewardedVideoAd {
NSLog(@"***adtapsyDidClickedRewardedVideoAd***");
}
-(void)adtapsyDidFailedToShowInterstitialAd {
NSLog(@"***adtapsyDidFailedToShowInterstitialAd***");
}
-(void)adtapsyDidFailedToShowRewardedVideoAd {
NSLog(@"***adtapsyDidFailedToShowRewardedVideoAd***");
}
-(void)adtapsyDidShowInterstitialAd {
NSLog(@"***adtapsyDidShowInterstitialAd***");
}
-(void)adtapsyDidShowRewardedVideoAd {
NSLog(@"***adtapsyDidShowRewardedVideoAd***");
}
-(void)adtapsyDidSkippedInterstitialAd {
NSLog(@"***adtapsyDidSkippedInterstitialAd***");
}
-(void)adtapsyDidSkippedRewardedVideoAd {
NSLog(@"***adtapsyDidSkippedRewardedVideoAd***");
}
-(void)adtapsyDidEarnedReward:(BOOL)success andAmount:(int)amount {
NSLog(@"***adtapsyDidEarnedReward*** success: %d amount %d", success, amount);
}
@end
[AdTapsy setTestMode:YES andTestDevices: @[ @"Simulator", @"Google device ID" ]];
Note: Disable before publish on App Store.
If you updating from an old AdTapsy SDK or if you have an old SDK versions of ad networks already bundled in AdTapsy, please remove them before adding the new one.
Choose "Copy items into destination group's folder" and click Finish
Vungle SDK is not included in the bundle, if you want to use Vungle ads please download it and copy VungleSDK.embeddedframework to your project https://v.vungle.com/dev/ios
Click Project -> Build Settings -> Search for other linker flags -> Add -ObjC like on screenshot
If your project is not using ARC, please add -fobjc-arc flag to be able to compile AdTapsy and ad networks SDKs.
Add required frameworks in Project options -> Active target -> Build Phases -> Link Binary With Libraries
StoreKit.framework (Required)
WebKit.framework (Required)
WatchConnectivity.framework (Required)
EventKit.framework (Required)
EventKitUI.framework (Required)
CoreData.framework (Required)
CoreMedia.framework (Required)
AudioToolbox.framework (Required)
AVFoundation.framework (Required)
CFNetwork.framework (Required)
CoreAudio.framework (Required)
CoreLocation.framework (Required)
CoreTelephony.framework (Required)
MediaPlayer.framework (Required)
MessageUI.framework (Required)
QuartzCore.framework (Required)
Security.framework (Required)
SystemConfiguration.framework (Required)
CoreGraphics.framework (Required)
UIKit.framework (Required)
Foundation.framework (Required)
libsqlite.3.0.tbd (Required)
libz.tbd (Required)
Social.framework (Optional)
StoreKit.framework (Optional)
WebKit.framework (Optional)
AdSupport.framework (Optional)
CoreBluetooth.framework (Optional)
Some of the frameworks are set to optional if you build for older iOS versions.
AdTapsy is compliant with ATS, however some of the ad networks still do not have compliant version of their SDK. It is recommended to disable ATS for now to have good fill rate from all ad networks. Add this code to your Info.plist file:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
More for iOS 9 Support
Import
AdTapsy.h
in
AppDelegate.m
and start session with
[AdTapsy startSession:@"ADTAPSY_APP_ID"];
in
didFinishLaunchingWithOptions
method
#import "AppDelegate.h"
#import "AdTapsy.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Start AdTapsy session
[AdTapsy startSession: @"ADTAPSY_APP_ID"];
return YES;
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Destroy on terminate
[AdTapsy destroy];
}
@end
#import "ViewController.h"
#import "AdTapsy.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[AdTapsy setDelegate:self];
[AdTapsy showInterstitial:self];
}
- (IBAction)showAd:(id)sender {
if ([AdTapsy isAdReadyToShow]) {
NSLog(@"Ad is ready be shown");
[AdTapsy showInterstitial:self];
} else {
NSLog(@"Ad is not ready to be shown");
}
}
When you want to show interstitial ad, use the code
[AdTapsy showInterstitial: viewController];
Note: You need to pass active View Controller as parameter. Getting the active View Controller depends on your code. Check some examples::
#import "AppDelegate.h"
#import "AdTapsy.h"
@implementation AppDelegate
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Show ad when coming from background mode
UIViewController * viewController = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
[AdTapsy showInterstitial: viewController];
}
@end
When you want to show rewarded video ad, use the code
[AdTapsy showRewardedVideo: viewController];
- (IBAction)showAd:(id)sender {
if ([AdTapsy isRewardedVideoReadyToShow]) {
NSLog(@"Ad is ready be shown");
[AdTapsy showRewardedVideo:self];
} else {
NSLog(@"Ad is not ready to be shown");
}
}
AdTapsy SDK requires that publishers set a flag indicating whether
a user located in the European Union (i.e., EU/GDPR data subject)
has provided opt-in consent for the collection and use of personal data.
The consent is passed to all enabled ad networks SDKs, if consent is not granted by user, then ad networks will not show targeted ads, collect/process personal data, etc.
Call this methods before initialize AdTapsy.
[AdTapsy setUserSubjectToGdpr: (BOOL)]; // YES by default
[AdTapsy setConsentGrantedGdpr: (BOOL)]; // NO by default
If the user is non EU citizen:
[AdTapsy setUserSubjectToGdpr: NO];
If the user is EU citizen (i.e., EU/GDPR data subject) and consent granted:
[AdTapsy setUserSubjectToGdpr: YES];
[AdTapsy setConsentGrantedGdpr: YES];
If the user is EU citizen (i.e., EU/GDPR data subject) and consent not granted or declined:
[AdTapsy setUserSubjectToGdpr: YES];
[AdTapsy setConsentGrantedGdpr: NO];
Now your project should build successfully and run.
Click here for Advanced Integration (Optional)[AdTapsy setRewardedVideoAmount:10];
If you are using server-side callbacks, you must set the user identifier
[AdTapsy setUserIdentifier: @"user1"];
If you want to use the networks default popups for rewarded video you can enable them
[AdTapsy setRewardedVideoPrePopupEnabled: YES];
[AdTapsy setRewardedVideoPostPopupEnabled: YES];
//
// ViewController.h
//
#import "AdTapsy.h"
@interface ViewController : UIViewController<ATLogDelegate, AdTapsyDelegate>
@end
Then in your implementation in the init method pass delegate object to AdTapsy and implement callback methods.
//
// ViewController.m
//
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[AdTapsy setDelegate: self];
}
-(void)adtapsyDidCachedInterstitialAd {
NSLog(@"***adtapsyDidCachedInterstitialAd***");
}
-(void)adtapsyDidCachedRewardedVideoAd {
NSLog(@"***adtapsyDidCachedRewardedVideoAd***");
}
-(void)adtapsyDidClickedInterstitialAd {
NSLog(@"***adtapsyDidClickedInterstitialAd***");
}
-(void)adtapsyDidClickedRewardedVideoAd {
NSLog(@"***adtapsyDidClickedRewardedVideoAd***");
}
-(void)adtapsyDidFailedToShowInterstitialAd {
NSLog(@"***adtapsyDidFailedToShowInterstitialAd***");
}
-(void)adtapsyDidFailedToShowRewardedVideoAd {
NSLog(@"***adtapsyDidFailedToShowRewardedVideoAd***");
}
-(void)adtapsyDidShowInterstitialAd {
NSLog(@"***adtapsyDidShowInterstitialAd***");
}
-(void)adtapsyDidShowRewardedVideoAd {
NSLog(@"***adtapsyDidShowRewardedVideoAd***");
}
-(void)adtapsyDidSkippedInterstitialAd {
NSLog(@"***adtapsyDidSkippedInterstitialAd***");
}
-(void)adtapsyDidSkippedRewardedVideoAd {
NSLog(@"***adtapsyDidSkippedRewardedVideoAd***");
}
-(void)adtapsyDidEarnedReward:(BOOL)success andAmount:(int)amount {
NSLog(@"***adtapsyDidEarnedReward*** success: %d amount %d", success, amount);
}
@end
[AdTapsy setTestMode:YES andTestDevices: @[ @"Simulator", @"Google device ID" ]];
Note: Disable before publish on App Store.
If you updating from an old AdTapsy SDK or if you have an old SDK versions of ad networks already bundled in AdTapsy, please remove them before adding the new one.
Choose "Copy items into destination group's folder" and click Finish
Vungle SDK is not included in the bundle, if you want to use Vungle ads please download it and copy VungleSDK.embeddedframework to your project https://v.vungle.com/dev/ios
Click Project -> Build Settings -> Search for other linker flags -> Add -ObjC like on screenshot
If your project is not using ARC, please add -fobjc-arc flag to be able to compile AdTapsy and ad networks SDKs.
Add required frameworks in Project options -> Active target -> Build Phases -> Link Binary With Libraries
StoreKit.framework (Required)
WebKit.framework (Required)
WatchConnectivity.framework (Required)
EventKit.framework (Required)
EventKitUI.framework (Required)
CoreData.framework (Required)
CoreMedia.framework (Required)
AudioToolbox.framework (Required)
AVFoundation.framework (Required)
CFNetwork.framework (Required)
CoreAudio.framework (Required)
CoreLocation.framework (Required)
CoreTelephony.framework (Required)
MediaPlayer.framework (Required)
MessageUI.framework (Required)
QuartzCore.framework (Required)
Security.framework (Required)
SystemConfiguration.framework (Required)
CoreGraphics.framework (Required)
UIKit.framework (Required)
Foundation.framework (Required)
libsqlite.3.0.tbd (Required)
libz.tbd (Required)
Social.framework (Optional)
StoreKit.framework (Optional)
WebKit.framework (Optional)
AdSupport.framework (Optional)
CoreBluetooth.framework (Optional)
Some of the frameworks are set to optional if you build for older iOS versions.
AdTapsy is compliant with ATS, however some of the ad networks still do not have compliant version of their SDK. It is recommended to disable ATS for now to have good fill rate from all ad networks. Add this code to your Info.plist file:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
More for iOS 9 Support
Create new header file Project-Bridging-Header.h
and import AdTapsy in it:
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import "AdTapsy.h"
Click Project -> Build Settings -> Search for Objective-C Bridging Headers -> Add "Project-Bridging-Header.h" like on screenshot
For more info check Apple Guide Swift and Objective-C in the Same Project section Importing Objective-C into Swift
Start session with AdTapsy.startSession("ADTAPSY_APP_ID");
in func application()
method of your AppDelegate.swift
//
// AppDelegate.swift
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
AdTapsy.startSession("ADTAPSY_APP_ID");
return true
}
//...
func applicationWillTerminate(application: UIApplication) {
AdTapsy.destroy();
}
}
When you want to show interstitial ad, use the code
AdTapsy.showInterstitial(viewController);
//
// ViewController.swift
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
AdTapsy.showInterstitial(self);
}
@IBAction func buttonPressed(sender: AnyObject) {
if (AdTapsy.isInterstitialReadyToShow()) {
println("Ad is ready to be shown");
AdTapsy.showInterstitial(self);
} else {
println("Ad is not ready to be shown");
}
}
}
Note: You need to pass active View Controller as parameter. Getting the active View Controller depends on your code. Check some examples:
//
// AppDelegate.swift
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func applicationDidBecomeActive(application: UIApplication) {
var rootViewController = self.window!.rootViewController
AdTapsy.showInterstitial(rootViewController);
}
}
When you want to show rewarded video ad, use the code
AdTapsy.showRewardedVideo(viewController);
//
// ViewController.swift
//
import UIKit
class ViewController: UIViewController {
@IBAction func buttonPressed(sender: AnyObject) {
if (AdTapsy.isRewardedVideoReadyToShow()) {
println("Ad is ready to be shown");
AdTapsy.showRewardedVideo(self);
} else {
println("Ad is not ready to be shown");
}
}
}
AdTapsy SDK requires that publishers set a flag indicating whether
a user located in the European Union (i.e., EU/GDPR data subject)
has provided opt-in consent for the collection and use of personal data.
The consent is passed to all enabled ad networks SDKs, if consent is not granted by user, then ad networks will not show targeted ads, collect/process personal data, etc.
Call this methods before initialize AdTapsy.
AdTapsy.setUserSubjectToGdpr(boolean); // true by default
AdTapsy.setConsentGrantedGdpr(boolean); // false by default
If the user is non EU citizen:
AdTapsy.setUserSubjectToGdpr(false);
If the user is EU citizen (i.e., EU/GDPR data subject) and consent granted:
AdTapsy.setUserSubjectToGdpr(true);
AdTapsy.setConsentGrantedGdpr(true);
If the user is EU citizen (i.e., EU/GDPR data subject) and consent not granted or declined:
AdTapsy.setUserSubjectToGdpr(true);
AdTapsy.setConsentGrantedGdpr(false);
Now your project should build successfully and run.
Click here for Advanced Integration (Optional)AdTapsy.setRewardedVideoAmount(10);
If you are using server-side callbacks, you must set the user identifier
AdTapsy.setUserIdentifier("user");
If you want to use the networks default popups for rewarded video you can enable them
AdTapsy.setRewardedVideoPrePopupEnabled(true);
AdTapsy.setRewardedVideoPostPopupEnabled(true);
//
// ViewController.swift
//
import UIKit
class ViewController: UIViewController, AdTapsyDelegate {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
AdTapsy.setDelegate(self);
}
// Add delegate functions
func adtapsyDidShowInterstitialAd() {
print("***adtapsyDidShowInterstitialAd***");
}
func adtapsyDidShowRewardedVideoAd() {
print("***adtapsyDidShowRewardedVideoAd***");
}
func adtapsyDidCachedInterstitialAd() {
print("***adtapsyDidCachedInterstitialAd***");
}
func adtapsyDidCachedRewardedVideoAd() {
print("***adtapsyDidCachedRewardedVideoAd***");
}
func adtapsyDidClickedInterstitialAd() {
print("***adtapsyDidClickedInterstitialAd***");
}
func adtapsyDidSkippedInterstitialAd() {
print("***adtapsyDidSkippedInterstitialAd***");
}
func adtapsyDidClickedRewardedVideoAd() {
print("***adtapsyDidClickedRewardedVideoAd***");
}
func adtapsyDidSkippedRewardedVideoAd() {
print("***adtapsyDidSkippedRewardedVideoAd***");
}
func adtapsyDidFailedToShowInterstitialAd() {
print("***adtapsyDidFailedToShowInterstitialAd***");
}
func adtapsyDidFailedToShowRewardedVideoAd() {
print("***adtapsyDidFailedToShowRewardedVideoAd***");
}
func adtapsyDidEarnedReward(success: Bool, andAmount amount: Int32) {
print("***adtapsyDidEarnedReward***");
}
}
AdTapsy.setTestMode(true, andTestDevices: ["Simulator", "Google device ID"]);
Note: Disable before publish on App Store.
Click Download iOS or Android project link
Select Include Optional SDKs and select AdTapsy iOS and/or Android
Click Prepare iOS/Android project and after it is completed download the code.
If you updating from an old AdTapsy SDK or if you have an old SDK versions of ad networks already bundled in AdTapsy, please remove them before adding the new one.
Choose "Copy items into destination group's folder" and click Finish
Vungle SDK is not included in the bundle, if you want to use Vungle ads please download it and copy VungleSDK.embeddedframework to your project https://v.vungle.com/dev/ios
Click Project -> Build Settings -> Search for other linker flags -> Add -ObjC like on screenshot
If your project is not using ARC, please add -fobjc-arc flag to be able to compile AdTapsy and ad networks SDKs.
Add required frameworks in Project options -> Active target -> Build Phases -> Link Binary With Libraries
StoreKit.framework (Required)
WebKit.framework (Required)
WatchConnectivity.framework (Required)
EventKit.framework (Required)
EventKitUI.framework (Required)
CoreData.framework (Required)
CoreMedia.framework (Required)
AudioToolbox.framework (Required)
AVFoundation.framework (Required)
CFNetwork.framework (Required)
CoreAudio.framework (Required)
CoreLocation.framework (Required)
CoreTelephony.framework (Required)
MediaPlayer.framework (Required)
MessageUI.framework (Required)
QuartzCore.framework (Required)
Security.framework (Required)
SystemConfiguration.framework (Required)
CoreGraphics.framework (Required)
UIKit.framework (Required)
Foundation.framework (Required)
libsqlite.3.0.tbd (Required)
libz.tbd (Required)
Social.framework (Optional)
StoreKit.framework (Optional)
WebKit.framework (Optional)
AdSupport.framework (Optional)
CoreBluetooth.framework (Optional)
Some of the frameworks are set to optional if you build for older iOS versions.
Import
AdTapsy.h
in
AppDelegate.m
and start session with
[AdTapsy startSession:@"ADTAPSY_APP_ID"];
in
didFinishLaunchingWithOptions
method
#import "AppDelegate.h"
#import "AdTapsy.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Start AdTapsy session
[AdTapsy startSession: @"ADTAPSY_APP_ID"];
return YES;
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Destroy on terminate
[AdTapsy destroy];
}
@end
#import "ViewController.h"
#import "AdTapsy.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[AdTapsy setDelegate:self];
[AdTapsy showInterstitial:self];
}
- (IBAction)showAd:(id)sender {
if ([AdTapsy isAdReadyToShow]) {
NSLog(@"Ad is ready be shown");
[AdTapsy showInterstitial:self];
} else {
NSLog(@"Ad is not ready to be shown");
}
}
When you want to show interstitial ad, use the code
[AdTapsy showInterstitial: viewController];
Note: You need to pass active View Controller as parameter. Getting the active View Controller depends on your code. Check some examples::
#import "AppDelegate.h"
#import "AdTapsy.h"
@implementation AppDelegate
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Show ad when coming from background mode
UIViewController * viewController = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
[AdTapsy showInterstitial: viewController];
}
@end
When you want to show rewarded video ad, use the code
[AdTapsy showRewardedVideo: viewController];
- (IBAction)showAd:(id)sender {
if ([AdTapsy isRewardedVideoReadyToShow]) {
NSLog(@"Ad is ready be shown");
[AdTapsy showRewardedVideo:self];
} else {
NSLog(@"Ad is not ready to be shown");
}
}
Now your project should build successfully and run.
Click here for Advanced Integration (Optional)[AdTapsy setRewardedVideoAmount:10];
If you are using server-side callbacks, you must set the user identifier
[AdTapsy setUserIdentifier: @"user1"];
If you want to use the networks default popups for rewarded video you can enable them
[AdTapsy setRewardedVideoPrePopupEnabled: YES];
[AdTapsy setRewardedVideoPostPopupEnabled: YES];
//
// ViewController.h
//
#import "AdTapsy.h"
@interface ViewController : UIViewController<ATLogDelegate, AdTapsyDelegate>
@end
Then in your implementation in the init method pass delegate object to AdTapsy and implement callback methods.
//
// ViewController.m
//
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[AdTapsy setDelegate: self];
}
-(void)adtapsyDidCachedInterstitialAd {
NSLog(@"***adtapsyDidCachedInterstitialAd***");
}
-(void)adtapsyDidCachedRewardedVideoAd {
NSLog(@"***adtapsyDidCachedRewardedVideoAd***");
}
-(void)adtapsyDidClickedInterstitialAd {
NSLog(@"***adtapsyDidClickedInterstitialAd***");
}
-(void)adtapsyDidClickedRewardedVideoAd {
NSLog(@"***adtapsyDidClickedRewardedVideoAd***");
}
-(void)adtapsyDidFailedToShowInterstitialAd {
NSLog(@"***adtapsyDidFailedToShowInterstitialAd***");
}
-(void)adtapsyDidFailedToShowRewardedVideoAd {
NSLog(@"***adtapsyDidFailedToShowRewardedVideoAd***");
}
-(void)adtapsyDidShowInterstitialAd {
NSLog(@"***adtapsyDidShowInterstitialAd***");
}
-(void)adtapsyDidShowRewardedVideoAd {
NSLog(@"***adtapsyDidShowRewardedVideoAd***");
}
-(void)adtapsyDidSkippedInterstitialAd {
NSLog(@"***adtapsyDidSkippedInterstitialAd***");
}
-(void)adtapsyDidSkippedRewardedVideoAd {
NSLog(@"***adtapsyDidSkippedRewardedVideoAd***");
}
-(void)adtapsyDidEarnedReward:(BOOL)success andAmount:(int)amount {
NSLog(@"***adtapsyDidEarnedReward*** success: %d amount %d", success, amount);
}
@end
[AdTapsy setTestMode:YES andTestDevices: @[ @"Simulator", @"Google device ID" ]];
Note: Disable before publish on App Store.
allprojects {
repositories {
jcenter()
google()
maven { url 'https://adtapsy.com/repo/' }
maven { url 'https://jitpack.io' }
maven { url "https://adcolony.bintray.com/AdColony" }
}
}
dependencies {
// AdTapsy
implementation 'com.adtapsy.sdk:adtapsy:1.5'
// Google play services
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-plus:15.0.1'
// AdColony
implementation 'com.adcolony:sdk:3.3.4'
implementation 'com.android.support:support-annotations:27.1.1'
// Applovin
implementation 'com.applovin:applovin-sdk:+'
// Vungle
implementation 'com.github.vungle:vungle-android-sdk:6.2.5'
// InMobi
implementation 'com.inmobi.monetization:inmobi-ads:7.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.android.support:recyclerview-v7:27.1.1'
}
Check Google's play services official documentation:
http://developer.android.com/google/play-services/setup.html
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- (Optional AdColony and Vungle only) -->
<uses-permission android:name="android.permission.VIBRATE" /> <!-- (Optional) -->
<!-- AdTapsy START -->
<!-- Google Play Services -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<!-- InMobi Activities -->
<activity
android:name="com.inmobi.rendering.InMobiAdActivity"
android:configChanges="keyboardHidden|orientation|keyboard|smallestScreenSize|screenSize"
android:hardwareAccelerated="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<receiver
android:name="com.inmobi.commons.core.utilities.uid.ImIdShareBroadCastReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.inmobi.share.id" />
</intent-filter>
</receiver>
<!-- AdColony Activities -->
<activity
android:name="com.adcolony.sdk.AdColonyInterstitialActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:hardwareAccelerated="true" />
<activity
android:name="com.adcolony.sdk.AdColonyAdViewActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:hardwareAccelerated="true" />
<!-- Applovin Activities -->
<activity android:name="com.applovin.adview.AppLovinInterstitialActivity" />
<activity android:name="com.applovin.adview.AppLovinConfirmationActivity" />
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
<!-- Vungle -->
<activity
android:name="com.vungle.warren.ui.VungleActivity"
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
android:launchMode="singleTop"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<!-- android-job -->
<service
android:name="com.evernote.android.job.v21.PlatformJobService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" />
<service
android:name="com.evernote.android.job.v14.PlatformAlarmService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" />
<service
android:name="com.evernote.android.job.v14.PlatformAlarmServiceExact"
android:exported="false" />
<receiver
android:name="com.evernote.android.job.v14.PlatformAlarmReceiver"
android:exported="false">
<intent-filter>
<!-- Keep the filter for legacy intents -->
<action android:name="com.evernote.android.job.v14.RUN_JOB" />
<action android:name="net.vrallev.android.job.v14.RUN_JOB" />
</intent-filter>
</receiver>
<receiver
android:name="com.evernote.android.job.JobBootReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
<service
android:name="com.evernote.android.job.gcm.PlatformGcmService"
android:enabled="false"
android:exported="true"
android:permission="com.google.android.gms.permission.BIND_NETWORK_TASK_SERVICE">
<intent-filter>
<action android:name="com.google.android.gms.gcm.ACTION_TASK_READY" />
</intent-filter>
</service>
<service
android:name="com.evernote.android.job.JobRescheduleService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" />
<!-- RevMob -->
<activity
android:name="rm.com.android.sdk.RmInterstitial"
android:configChanges="keyboardHidden|orientation|screenSize" />
<!-- Chartboost -->
<activity
android:name="com.chartboost.sdk.CBImpressionActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:excludeFromRecents="true"
android:hardwareAccelerated="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<!-- AdTapsy END -->
In case you are currently extending base android.app.Activity
you can just extend AdTapsyActivity.
import com.adtapsy.sdk.AdTapsyActivity;
public class MainActivity extends AdTapsyActivity {
}
If you are extending some more complex activity, then you should override these methods in your activity onStart(), onPause(), onResume(), onStop(), onDestroy() and onBackPressed():
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AdTapsy.onCreate(this);
}
@Override
protected void onStart() {
super.onStart();
AdTapsy.onStart(this);
}
@Override
public void onResume() {
super.onResume();
AdTapsy.onResume(this);
}
@Override
public void onPause() {
super.onPause();
AdTapsy.onPause(this);
}
@Override
public void onStop() {
super.onStop();
AdTapsy.onStop(this);
}
@Override
public void onDestroy() {
super.onDestroy();
AdTapsy.onDestroy(this);
}
@Override
public void onBackPressed() {
// If ad is on the screen - close it
if(!AdTapsy.closeAd()){
super.onBackPressed();
}
}
If you are using requestFeature() in your onCreate method, make sure you call it before calling AdTapsy.onCreate() or super.onCreate()
@Override
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
AdTapsy.startSession(this, "ADTAPSY_APP_ID");
}
Use showInterstitial method on places where you want to show static or video interstitial ads
AdTapsy.showInterstitial(this);
If you want to check is ad is cached and ready to be shown use isAdReadyToShow method
public void showAd() {
if (AdTapsy.isInterstitialReadyToShow()) {
Log.d("AdTapsy", "Ad is ready to be shown");
AdTapsy.showInterstitial(this);
} else {
Log.d("AdTapsy", "Ad is not ready to be shown");
}
}
Use showRewardedVideo method on places where you want to show rewarded videos
public void showRewardedVideo() {
if (AdTapsy.isRewardedVideoReadyToShow()) {
Log.d("AdTapsy", "Ad is ready to be shown");
AdTapsy.showRewardedVideo(this);
} else {
Log.d("AdTapsy", "Ad is not ready to be shown");
}
}
AdTapsy SDK requires that publishers set a flag indicating whether
a user located in the European Union (i.e., EU/GDPR data subject)
has provided opt-in consent for the collection and use of personal data.
The consent is passed to all enabled ad networks SDKs, if consent is not granted by user, then ad networks will not show targeted ads, collect/process personal data, etc.
Call this methods before initialize AdTapsy.
AdTapsy.setUserSubjectToGdpr(boolean); // true by default
AdTapsy.setConsentGrantedGdpr(boolean); // false by default
If the user is non EU citizen:
AdTapsy.setUserSubjectToGdpr(false);
If the user is EU citizen (i.e., EU/GDPR data subject) and consent granted:
AdTapsy.setUserSubjectToGdpr(true);
AdTapsy.setConsentGrantedGdpr(true);
If the user is EU citizen (i.e., EU/GDPR data subject) and consent not granted or declined:
AdTapsy.setUserSubjectToGdpr(true);
AdTapsy.setConsentGrantedGdpr(false);
Now your project should build successfully and run.
Click here for Advanced Integration (Optional)
AdTapsy.setDelegate(new AdTapsyDelegate() {
@Override
public void onAdSkipped(int zoneId) {
if(zoneId == AdTapsy.INTERSTITIAL_ZONE){
Log.d("AdTapsy Delegate", "Ad skipped from interstitial zone ");
} else if(zoneId == AdTapsy.REWARDED_VIDEO_ZONE){
Log.d("AdTapsy Delegate", "Ad skipped from rewarded video zone ");
}
}
@Override
public void onAdShown(int zoneId) {
if(zoneId == AdTapsy.INTERSTITIAL_ZONE){
Log.d("AdTapsy Delegate", "Ad shown from interstitial zone");
} else if(zoneId == AdTapsy.REWARDED_VIDEO_ZONE){
Log.d("AdTapsy Delegate", "Ad shown from rewarded video zone");
}
}
@Override
public void onAdFailToShow(int zoneId) {
if(zoneId == AdTapsy.INTERSTITIAL_ZONE){
Log.d("AdTapsy Delegate", "Ad failed to show from zone " + zoneId);
} else if(zoneId == AdTapsy.REWARDED_VIDEO_ZONE){
Log.d("AdTapsy Delegate", "Ad failed to show from rewarded video zone");
}
}
@Override
public void onAdClicked(int zoneId) {
if(zoneId == AdTapsy.INTERSTITIAL_ZONE){
Log.d("AdTapsy Delegate", "Ad clicked from interstitial zone");
} else if(zoneId == AdTapsy.REWARDED_VIDEO_ZONE){
Log.d("AdTapsy Delegate", "Ad clicked from rewarded video zone");
}
}
@Override
public void onAdCached(int zoneId) {
if(zoneId == AdTapsy.INTERSTITIAL_ZONE){
Log.d("AdTapsy Delegate", "Ad loaded from interstitial zone");
} else if(zoneId == AdTapsy.REWARDED_VIDEO_ZONE){
Log.d("AdTapsy Delegate", "Ad loaded from rewarded zone zone");
}
}
});
AdTapsy.setRewardedDelegate(new AdTapsyRewardedDelegate() {
@Override
public void onRewardEarned(int amount) {
Log.d("AdTapsy Rewarded Delegate", "User earned " + amount + " coins");
}
});
AdTapsy.setRewardedVideoAmount(10);
If you are using server-side callbacks, you must set the user identifier
AdTapsy.setUserIdentifier("user");
If you want to use the networks default popups for rewarded video you can enable them
AdTapsy.setRewardedVideoPrePopupEnabled(true);
AdTapsy.setRewardedVideoPostPopupEnabled(true);
If you are using ProGuard, copy/paste this configuration to your proguard-project.txt
## AdTapsy START
# AdTapsy
-keep class com.adtapsy.sdk.** { *; }
#AdColony
# For communication with AdColony's WebView
-keepclassmembers class * {
@android.webkit.JavascriptInterface <methods>;
}
# Keep ADCNative class members unobfuscated
-keepclassmembers class com.adcolony.sdk.ADCNative** {
*;
}
# For removing warnings due to lack of Multi-Window support
-dontwarn android.app.Activity
# StartApp
-keep class com.startapp.** {
*;
}
-keepattributes Exceptions, InnerClasses, Signature, Deprecated, SourceFile, LineNumberTable, *Annotation*, EnclosingMethod
-dontwarn android.webkit.JavascriptInterface
-dontwarn com.startapp.**
# Vungle
-keep class com.vungle.warren.** { *; }
# Evernote
-dontwarn com.evernote.android.job.gcm.**
-dontwarn com.evernote.android.job.GcmAvailableHelper
-dontwarn com.google.android.gms.ads.identifier.**
-keep public class com.evernote.android.job.v21.PlatformJobService
-keep public class com.evernote.android.job.v14.PlatformAlarmService
-keep public class com.evernote.android.job.v14.PlatformAlarmReceiver
-keep public class com.evernote.android.job.JobBootReceiver
-keep public class com.evernote.android.job.JobRescheduleService
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-keep class com.google.android.gms.internal.** { *; }
# Moat SDK
-keep class com.moat.** { *; }
-dontwarn com.moat.**
# Retrofit
-dontwarn okio.**
-dontwarn retrofit2.Platform$Java8
# Chartboost
-keep class com.chartboost.** { *; }
# RevMob and Google Play Services
-keep class com.revmob.** {*;}
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
-keep class rm.com.android.** {*;}
-keep class rm.com.android.sdk.** {*;}
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}
# InMobi
-keepattributes SourceFile,LineNumberTable
-keep class com.inmobi.** { *; }
-dontwarn com.inmobi.**
-keep public class com.google.android.gms.**
-dontwarn com.google.android.gms.**
-dontwarn com.squareup.picasso.**
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient{
public *;
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info{
public *;
}
# skip the Picasso library classes
-keep class com.squareup.picasso.** {*;}
-dontwarn com.squareup.picasso.**
-dontwarn com.squareup.okhttp.**
# skip Moat classes
-keep class com.moat.** {*;}
-dontwarn com.moat.**
# skip AVID classes
-keep class com.integralads.avid.library.* {*;}
-dontwarn android.app.Activity
-dontwarn java.lang.invoke.**
# AdTapsy END
Click Download iOS or Android project link
Select Include Optional SDKs and select AdTapsy iOS and/or Android
Click Prepare iOS/Android project and after it is completed download the code.
allprojects {
repositories {
jcenter()
google()
maven { url 'https://adtapsy.com/repo/' }
maven { url 'https://jitpack.io' }
maven { url "https://adcolony.bintray.com/AdColony" }
}
}
dependencies {
// AdTapsy
implementation 'com.adtapsy.sdk:adtapsy:1.5'
// Google play services
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-plus:15.0.1'
// AdColony
implementation 'com.adcolony:sdk:3.3.4'
implementation 'com.android.support:support-annotations:27.1.1'
// Applovin
implementation 'com.applovin:applovin-sdk:+'
// Vungle
implementation 'com.github.vungle:vungle-android-sdk:6.2.5'
// InMobi
implementation 'com.inmobi.monetization:inmobi-ads:7.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.android.support:recyclerview-v7:27.1.1'
}
Check Google's play services official documentation:
http://developer.android.com/google/play-services/setup.html
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- (Optional AdColony and Vungle only) -->
<uses-permission android:name="android.permission.VIBRATE" /> <!-- (Optional) -->
<!-- AdTapsy START -->
<!-- Google Play Services -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<!-- InMobi Activities -->
<activity
android:name="com.inmobi.rendering.InMobiAdActivity"
android:configChanges="keyboardHidden|orientation|keyboard|smallestScreenSize|screenSize"
android:hardwareAccelerated="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<receiver
android:name="com.inmobi.commons.core.utilities.uid.ImIdShareBroadCastReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.inmobi.share.id" />
</intent-filter>
</receiver>
<!-- AdColony Activities -->
<activity
android:name="com.adcolony.sdk.AdColonyInterstitialActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:hardwareAccelerated="true" />
<activity
android:name="com.adcolony.sdk.AdColonyAdViewActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:hardwareAccelerated="true" />
<!-- Applovin Activities -->
<activity android:name="com.applovin.adview.AppLovinInterstitialActivity" />
<activity android:name="com.applovin.adview.AppLovinConfirmationActivity" />
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
<!-- Vungle -->
<activity
android:name="com.vungle.warren.ui.VungleActivity"
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
android:launchMode="singleTop"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<!-- android-job -->
<service
android:name="com.evernote.android.job.v21.PlatformJobService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" />
<service
android:name="com.evernote.android.job.v14.PlatformAlarmService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" />
<service
android:name="com.evernote.android.job.v14.PlatformAlarmServiceExact"
android:exported="false" />
<receiver
android:name="com.evernote.android.job.v14.PlatformAlarmReceiver"
android:exported="false">
<intent-filter>
<!-- Keep the filter for legacy intents -->
<action android:name="com.evernote.android.job.v14.RUN_JOB" />
<action android:name="net.vrallev.android.job.v14.RUN_JOB" />
</intent-filter>
</receiver>
<receiver
android:name="com.evernote.android.job.JobBootReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
<service
android:name="com.evernote.android.job.gcm.PlatformGcmService"
android:enabled="false"
android:exported="true"
android:permission="com.google.android.gms.permission.BIND_NETWORK_TASK_SERVICE">
<intent-filter>
<action android:name="com.google.android.gms.gcm.ACTION_TASK_READY" />
</intent-filter>
</service>
<service
android:name="com.evernote.android.job.JobRescheduleService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" />
<!-- RevMob -->
<activity
android:name="rm.com.android.sdk.RmInterstitial"
android:configChanges="keyboardHidden|orientation|screenSize" />
<!-- Chartboost -->
<activity
android:name="com.chartboost.sdk.CBImpressionActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:excludeFromRecents="true"
android:hardwareAccelerated="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<!-- AdTapsy END -->
In case you are currently extending base android.app.Activity
you can just extend AdTapsyActivity.
import com.adtapsy.sdk.AdTapsyActivity;
public class MainActivity extends AdTapsyActivity {
}
If you are extending some more complex activity, then you should override these methods in your activity onStart(), onPause(), onResume(), onStop(), onDestroy() and onBackPressed():
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AdTapsy.onCreate(this);
}
@Override
protected void onStart() {
super.onStart();
AdTapsy.onStart(this);
}
@Override
public void onResume() {
super.onResume();
AdTapsy.onResume(this);
}
@Override
public void onPause() {
super.onPause();
AdTapsy.onPause(this);
}
@Override
public void onStop() {
super.onStop();
AdTapsy.onStop(this);
}
@Override
public void onDestroy() {
super.onDestroy();
AdTapsy.onDestroy(this);
}
@Override
public void onBackPressed() {
// If ad is on the screen - close it
if(!AdTapsy.closeAd()){
super.onBackPressed();
}
}
If you are using requestFeature() in your onCreate method, make sure you call it before calling AdTapsy.onCreate() or super.onCreate()
@Override
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
AdTapsy.startSession(this, "ADTAPSY_APP_ID");
}
Use showInterstitial method on places where you want to show static or video interstitial ads
AdTapsy.showInterstitial(this);
If you want to check is ad is cached and ready to be shown use isAdReadyToShow method
public void showAd() {
if (AdTapsy.isInterstitialReadyToShow()) {
Log.d("AdTapsy", "Ad is ready to be shown");
AdTapsy.showInterstitial(this);
} else {
Log.d("AdTapsy", "Ad is not ready to be shown");
}
}
Use showRewardedVideo method on places where you want to show rewarded videos
public void showRewardedVideo() {
if (AdTapsy.isRewardedVideoReadyToShow()) {
Log.d("AdTapsy", "Ad is ready to be shown");
AdTapsy.showRewardedVideo(this);
} else {
Log.d("AdTapsy", "Ad is not ready to be shown");
}
}
AdTapsy SDK requires that publishers set a flag indicating whether
a user located in the European Union (i.e., EU/GDPR data subject)
has provided opt-in consent for the collection and use of personal data.
The consent is passed to all enabled ad networks SDKs, if consent is not granted by user, then ad networks will not show targeted ads, collect/process personal data, etc.
Call this methods before initialize AdTapsy.
AdTapsy.setUserSubjectToGdpr(boolean); // true by default
AdTapsy.setConsentGrantedGdpr(boolean); // false by default
If the user is non EU citizen:
AdTapsy.setUserSubjectToGdpr(false);
If the user is EU citizen (i.e., EU/GDPR data subject) and consent granted:
AdTapsy.setUserSubjectToGdpr(true);
AdTapsy.setConsentGrantedGdpr(true);
If the user is EU citizen (i.e., EU/GDPR data subject) and consent not granted or declined:
AdTapsy.setUserSubjectToGdpr(true);
AdTapsy.setConsentGrantedGdpr(false);
Now your project should build successfully and run.
Click here for Advanced Integration (Optional)
AdTapsy.setDelegate(new AdTapsyDelegate() {
@Override
public void onAdSkipped(int zoneId) {
if(zoneId == AdTapsy.INTERSTITIAL_ZONE){
Log.d("AdTapsy Delegate", "Ad skipped from interstitial zone ");
} else if(zoneId == AdTapsy.REWARDED_VIDEO_ZONE){
Log.d("AdTapsy Delegate", "Ad skipped from rewarded video zone ");
}
}
@Override
public void onAdShown(int zoneId) {
if(zoneId == AdTapsy.INTERSTITIAL_ZONE){
Log.d("AdTapsy Delegate", "Ad shown from interstitial zone");
} else if(zoneId == AdTapsy.REWARDED_VIDEO_ZONE){
Log.d("AdTapsy Delegate", "Ad shown from rewarded video zone");
}
}
@Override
public void onAdFailToShow(int zoneId) {
if(zoneId == AdTapsy.INTERSTITIAL_ZONE){
Log.d("AdTapsy Delegate", "Ad failed to show from zone " + zoneId);
} else if(zoneId == AdTapsy.REWARDED_VIDEO_ZONE){
Log.d("AdTapsy Delegate", "Ad failed to show from rewarded video zone");
}
}
@Override
public void onAdClicked(int zoneId) {
if(zoneId == AdTapsy.INTERSTITIAL_ZONE){
Log.d("AdTapsy Delegate", "Ad clicked from interstitial zone");
} else if(zoneId == AdTapsy.REWARDED_VIDEO_ZONE){
Log.d("AdTapsy Delegate", "Ad clicked from rewarded video zone");
}
}
@Override
public void onAdCached(int zoneId) {
if(zoneId == AdTapsy.INTERSTITIAL_ZONE){
Log.d("AdTapsy Delegate", "Ad loaded from interstitial zone");
} else if(zoneId == AdTapsy.REWARDED_VIDEO_ZONE){
Log.d("AdTapsy Delegate", "Ad loaded from rewarded zone zone");
}
}
});
AdTapsy.setRewardedDelegate(new AdTapsyRewardedDelegate() {
@Override
public void onRewardEarned(int amount) {
Log.d("AdTapsy Rewarded Delegate", "User earned " + amount + " coins");
}
});
AdTapsy.setRewardedVideoAmount(10);
If you are using server-side callbacks, you must set the user identifier
AdTapsy.setUserIdentifier("user");
If you want to use the networks default popups for rewarded video you can enable them
AdTapsy.setRewardedVideoPrePopupEnabled(true);
AdTapsy.setRewardedVideoPostPopupEnabled(true);
If you are using ProGuard, copy/paste this configuration to your proguard-project.txt
## AdTapsy START
# AdTapsy
-keep class com.adtapsy.sdk.** { *; }
#AdColony
# For communication with AdColony's WebView
-keepclassmembers class * {
@android.webkit.JavascriptInterface <methods>;
}
# Keep ADCNative class members unobfuscated
-keepclassmembers class com.adcolony.sdk.ADCNative** {
*;
}
# For removing warnings due to lack of Multi-Window support
-dontwarn android.app.Activity
# StartApp
-keep class com.startapp.** {
*;
}
-keepattributes Exceptions, InnerClasses, Signature, Deprecated, SourceFile, LineNumberTable, *Annotation*, EnclosingMethod
-dontwarn android.webkit.JavascriptInterface
-dontwarn com.startapp.**
# Vungle
-keep class com.vungle.warren.** { *; }
# Evernote
-dontwarn com.evernote.android.job.gcm.**
-dontwarn com.evernote.android.job.GcmAvailableHelper
-dontwarn com.google.android.gms.ads.identifier.**
-keep public class com.evernote.android.job.v21.PlatformJobService
-keep public class com.evernote.android.job.v14.PlatformAlarmService
-keep public class com.evernote.android.job.v14.PlatformAlarmReceiver
-keep public class com.evernote.android.job.JobBootReceiver
-keep public class com.evernote.android.job.JobRescheduleService
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-keep class com.google.android.gms.internal.** { *; }
# Moat SDK
-keep class com.moat.** { *; }
-dontwarn com.moat.**
# Retrofit
-dontwarn okio.**
-dontwarn retrofit2.Platform$Java8
# Chartboost
-keep class com.chartboost.** { *; }
# RevMob and Google Play Services
-keep class com.revmob.** {*;}
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
-keep class rm.com.android.** {*;}
-keep class rm.com.android.sdk.** {*;}
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}
# InMobi
-keepattributes SourceFile,LineNumberTable
-keep class com.inmobi.** { *; }
-dontwarn com.inmobi.**
-keep public class com.google.android.gms.**
-dontwarn com.google.android.gms.**
-dontwarn com.squareup.picasso.**
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient{
public *;
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info{
public *;
}
# skip the Picasso library classes
-keep class com.squareup.picasso.** {*;}
-dontwarn com.squareup.picasso.**
-dontwarn com.squareup.okhttp.**
# skip Moat classes
-keep class com.moat.** {*;}
-dontwarn com.moat.**
# skip AVID classes
-keep class com.integralads.avid.library.* {*;}
-dontwarn android.app.Activity
-dontwarn java.lang.invoke.**
# AdTapsy END
Open your Unity project -> Double click AdTapsy-Unity-Plugin.unitypackage -> Click "Import" button
Vungle SDK is not included in the bundle, if you want to use Vungle ads please download it and copy vungle-publisher-adaptive-id/libs to Assets/Plugins/Android directory of your Unity project https://v.vungle.com/dev/android
If you don't have a manifest file at Assets/Plugins/Android/AndroidManifest.xml you can just copy there AndroidManifest.xml that you downloaded with our Unity plugin and skip to step 5. Otherwise, you must follow the next steps to configure your existing AndroidManifest
Click here if you already have AndroidManifest in your project<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- (Optional AdColony and Vungle only) -->
<uses-permission android:name="android.permission.VIBRATE" /> <!-- (Optional) -->
<!-- AdTapsy START -->
<!-- Google Play Services -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<!-- InMobi Activities -->
<activity
android:name="com.inmobi.rendering.InMobiAdActivity"
android:configChanges="keyboardHidden|orientation|keyboard|smallestScreenSize|screenSize"
android:hardwareAccelerated="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<receiver
android:name="com.inmobi.commons.core.utilities.uid.ImIdShareBroadCastReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.inmobi.share.id" />
</intent-filter>
</receiver>
<!-- AdColony Activities -->
<activity
android:name="com.adcolony.sdk.AdColonyInterstitialActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:hardwareAccelerated="true" />
<activity
android:name="com.adcolony.sdk.AdColonyAdViewActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:hardwareAccelerated="true" />
<!-- Applovin Activities -->
<activity android:name="com.applovin.adview.AppLovinInterstitialActivity" />
<activity android:name="com.applovin.adview.AppLovinConfirmationActivity" />
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
<!-- Vungle -->
<activity
android:name="com.vungle.warren.ui.VungleActivity"
android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
android:launchMode="singleTop"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<!-- android-job -->
<service
android:name="com.evernote.android.job.v21.PlatformJobService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" />
<service
android:name="com.evernote.android.job.v14.PlatformAlarmService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" />
<service
android:name="com.evernote.android.job.v14.PlatformAlarmServiceExact"
android:exported="false" />
<receiver
android:name="com.evernote.android.job.v14.PlatformAlarmReceiver"
android:exported="false">
<intent-filter>
<!-- Keep the filter for legacy intents -->
<action android:name="com.evernote.android.job.v14.RUN_JOB" />
<action android:name="net.vrallev.android.job.v14.RUN_JOB" />
</intent-filter>
</receiver>
<receiver
android:name="com.evernote.android.job.JobBootReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
<service
android:name="com.evernote.android.job.gcm.PlatformGcmService"
android:enabled="false"
android:exported="true"
android:permission="com.google.android.gms.permission.BIND_NETWORK_TASK_SERVICE">
<intent-filter>
<action android:name="com.google.android.gms.gcm.ACTION_TASK_READY" />
</intent-filter>
</service>
<service
android:name="com.evernote.android.job.JobRescheduleService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" />
<!-- RevMob -->
<activity
android:name="rm.com.android.sdk.RmInterstitial"
android:configChanges="keyboardHidden|orientation|screenSize" />
<!-- Chartboost -->
<activity
android:name="com.chartboost.sdk.CBImpressionActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:excludeFromRecents="true"
android:hardwareAccelerated="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<!-- AdTapsy END -->
You must change the name attribute of your main activity (the one with <action android:name="android.intent.action.MAIN" />) to "com.adtapsy.sdk.AdTapsyUnityActivity".
If your current main activity name is different from "com.unity3d.player.UnityPlayerActivity" you must create a new activity class that extends your current one and calls AdTapsy life cycle methods:
1. Download Eclipse, create a new Android Library project and import Unity java libraries from Unity/Player/PlaybackEngines/AndroidPlayer/bin/classes.jar, all of your current activity's dependencies and the AdTapsy jar file
2. Create a new class that extends your current activity
3. Overwrite its life cycle methods as follows:
public class YourNewActivity extends YourCurrentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AdTapsy.onCreate(this);
}
@Override
protected void onStart() {
super.onStart();
AdTapsy.onStart(this);
}
@Override
public void onResume() {
super.onResume();
AdTapsy.onResume(this);
}
@Override
public void onPause() {
super.onPause();
AdTapsy.onPause(this);
}
@Override
public void onStop() {
super.onStop();
AdTapsy.onStop(this);
}
@Override
public void onDestroy() {
super.onDestroy();
AdTapsy.onDestroy(this);
}
@Override
public void onBackPressed() {
// If ad is on the screen - close it
if(!AdTapsy.closeAd()){
super.onBackPressed();
}
}
}
4. Build the project and copy the jar file from the /bin directory to the Assets/Plugins/Android folder in your gameIn your game initialization you need to start session with the method AdTapsy.StartSessionAndroid("ADTAPSY_APP_ID");
void Start () {
//...
AdTapsy.StartSessionAndroid("ADTAPSY_APP_ID");
//...
}
Use the method
AdTapsy.ShowInterstitial()
at places where you want to show ads. Such places can be on game start,
after the game become active, on game pauses, etc.
void Start () {
AdTapsy.ShowInterstitial();
}
void ShowInterstitial() {
if (AdTapsy.isAdReadyToShow()) {
UnityEngine.Debug.Log("Ad is ready to be shown");
AdTapsy.ShowInterstitial();
} else {
UnityEngine.Debug.Log("Ad is not ready to be shown");
}
}
void OnApplicationPause(bool pauseStatus) {
if (!pauseStatus) {
AdTapsy.ShowInterstitial();
}
}
Use the method
AdTapsy.ShowRewardedVideo()
at places where you want to show rewarded video ads.
void ShowRewardedVideo() {
if (AdTapsy.IsRewardedVideoReadyToShow ()) {
UnityEngine.Debug.Log("Ad is ready to be shown");
AdTapsy.ShowRewardedVideo();
} else {
UnityEngine.Debug.Log("Ad is not ready to be shown");
}
}
AdTapsy.CloseAd()
in your Update() method to enable users to close interstitial ads when pressing the back button on their devices.
void Update() {
if (Input.GetKeyDown(KeyCode.Escape)) {
/* AdTapsy.CloseAd returns whether an interstitial ad was closed.
* If so, don't do anything, else handle your events
*/
bool adClosed = AdTapsy.CloseAd();
if(!adClosed){
/* Handle your game lifecycle here -
return to previous scene, exit game, close popup, etc. */
}
}
}
AdTapsy SDK requires that publishers set a flag indicating whether
a user located in the European Union (i.e., EU/GDPR data subject)
has provided opt-in consent for the collection and use of personal data.
The consent is passed to all enabled ad networks SDKs, if consent is not granted by user, then ad networks will not show targeted ads, collect/process personal data, etc.
Call this methods before initialize AdTapsy.
AdTapsy.SetUserSubjectToGdpr(boolean); // true by default
AdTapsy.SetConsentGrantedGdpr(boolean); // false by default
If the user is non EU citizen:
AdTapsy.SetUserSubjectToGdpr(false);
If the user is EU citizen (i.e., EU/GDPR data subject) and consent granted:
AdTapsy.setUserSubjectToGdpr(true);
AdTapsy.SetConsentGrantedGdpr(true);
If the user is EU citizen (i.e., EU/GDPR data subject) and consent not granted or declined:
AdTapsy.setUserSubjectToGdpr(true);
AdTapsy.SetConsentGrantedGdpr(false);
Now your project should build successfully and run.
Click here for Advanced Integration (Optional)
void Start ()
{
AdTapsy.OnAdCached += delegate(int zoneId) {
if(zoneId == AdTapsy.InterstitialZone){
UnityEngine.Debug.Log("***AdTapsy cached interstitial ad***");
} else if(zoneId == AdTapsy.RewardedVideoZone){
UnityEngine.Debug.Log("***AdTapsy cached rewarded ad***");
}
};
AdTapsy.OnAdShown += delegate(int zoneId){
if(zoneId == AdTapsy.InterstitialZone){
UnityEngine.Debug.Log("***AdTapsy showed interstitial ad***");
} else if(zoneId == AdTapsy.RewardedVideoZone){
UnityEngine.Debug.Log("***AdTapsy showed rewarded ad***");
}
};
AdTapsy.OnAdSkipped += delegate(int zoneId){
if(zoneId == AdTapsy.InterstitialZone){
UnityEngine.Debug.Log("***AdTapsy skipped interstitial ad***");
} else if(zoneId == AdTapsy.RewardedVideoZone){
UnityEngine.Debug.Log("***AdTapsy skipped rewarded ad***");
}
};
AdTapsy.OnAdFailedToShow += delegate(int zoneId) {
if(zoneId == AdTapsy.InterstitialZone){
UnityEngine.Debug.Log("***AdTapsy failed to show interstitial ad***");
} else if(zoneId == AdTapsy.RewardedVideoZone){
UnityEngine.Debug.Log("***AdTapsy failed to show rewarded ad***");
}
};
AdTapsy.OnAdClicked += delegate(int zoneId) {
if(zoneId == AdTapsy.InterstitialZone){
UnityEngine.Debug.Log("***AdTapsy clicked interstitial ad***");
} else if(zoneId == AdTapsy.RewardedVideoZone){
UnityEngine.Debug.Log("***AdTapsy clicked rewarded ad***");
}
};
AdTapsy.OnRewardEarned += delegate(int amount){
UnityEngine.Debug.Log("***AdTapsy reward earned " + amount + "***");
};
}
AdTapsy.SetRewardedVideoAmount (10);
If you are using server-side callbacks, you must set the user identifier
AdTapsy.SetUserIdentifier ("user1");
If you want to use the networks default popups for rewarded video you can enable them
AdTapsy.SetRewardedVideoPrePopupEnabled (false);
AdTapsy.SetRewardedVideoPostPopupEnabled (false);
void Start ()
{
AdTapsy.SetTestMode (true, "Simulator", "Google Device ID");
}
Note: Disable before publish on App Store.
In Eclipse select File-> Import -> Existing Android Code Into Workspace and select YourGame/proj.android folder. Also import the project from your-cocos2dx-dir/cocos/platform/android/java/libcocos2dx and set it as a library project to your game.
Copy AdTapsy plugin to MyGame/cocos2d/plugin/plugins directory
Vungle SDK is not included in the bundle, if you want to use Vungle ads please download it and copy vungle-publisher-adaptive-id/libs to MyGame/cocos2d/plugin/plugins/adtapsy/sdk directory of your Cocos2dx project https://v.vungle.com/dev/android
Run MyGame/cocos2d/plugin/tools/publish.sh to compile the plugin Run MyGame/cocos2d/plugin/tools/gameDevGuide.sh and select adtapsy to be added to your project Open Eclipse, right click on your project and select Refresh If there is no plugin-x folder in your Eclipse project and you have build path errors because of that, follow this guide to add it as a linked resource. Select folder name: plugin-x , target folder: MyGame/cocos2d/plugin/publish Add this line to MyGame/proj.android/jni/Android.mk
$(call import-module,plugin/protocols/proj.android/jni)
Remove this line if present in your Android.mk file
$(call import-module,protocols/android)
Set the JVM to the JNI helper in MyGame/proj.android/jni/hellocpp/main.cpp
#include "PluginJniHelper.h" // new import
void cocos_android_app_init (JNIEnv* env, jobject thiz) {
LOGD("cocos_android_app_init");
AppDelegate *pAppDelegate = new AppDelegate();
// new code start
JavaVM* vm;
env->GetJavaVM(&vm);
PluginJniHelper::setJavaVM(vm);
// new code end
}
Copy AdTapsyCocosActivity in your project and let your AppActivity extend it
Initialize PluginWrapper in AppActivity.java onCreate method
public class AppActivity extends AdTapsyCocosActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PluginWrapper.init(this);
}
}
Right click on your project in Eclipse -> Android Tools -> Add support library
dependencies {
// AdTapsy
implementation 'com.adtapsy.sdk:adtapsy:1.5'
// Google play services
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-plus:15.0.1'
// AdColony
implementation 'com.adcolony:sdk:3.3.4'
implementation 'com.android.support:support-annotations:27.1.1'
// Applovin
implementation 'com.applovin:applovin-sdk:+'
// Vungle
implementation 'com.github.vungle:vungle-android-sdk:6.2.5'
// InMobi
implementation 'com.inmobi.monetization:inmobi-ads:7.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.android.support:recyclerview-v7:27.1.1'
}
Check Google's play services official documentation:
http://developer.android.com/google/play-services/setup.html
Add imports:
#include "PluginManager.h"
#include "ProtocolAds.h"
Get pointer to the AdTapsy plugin object:
auto adtapsy = dynamic_cast(cocos2d::plugin::PluginManager::getInstance()->loadPlugin("AdTapsy"));
Initialize plugin only once on app start:
std::map developer_info;
developer_info["appId"] = "YOUR_ADTAPSY_APP_ID";
adtapsy-> configDeveloperInfo(developer_info);
Call this method when you want to show an ad
bool readyToShow = adtapsy-> callBoolFuncWithParam("isInterstitialReadyToShow", NULL);
if(readyToShow){
adtapsy-> callFuncWithParam("showInterstitial", NULL);
} else {
CCLOG("*** No ad ready to show***");
}
Call this method when you want to show a rewarded video
bool readyToShow = adtapsy-> callBoolFuncWithParam("isRewardedVideoReadyToShow", NULL);
if(readyToShow){
adtapsy-> callFuncWithParam("showRewardedVideo", NULL);
} else {
CCLOG("*** No ad ready to show***");
}
Now your project should build successfully and run.
Click here for Advanced Integration (Optional)To listen for ad events create a class that extends cocos2d::plugin::AdsListener
class MyAdsListener: public cocos2d::plugin::AdsListener
{
void onAdsResult(cocos2d::plugin::AdsResultCode code, const char* msg)
{
if(code == cocos2d::plugin::AdsResultCode::kAdsShown) {
CCLOG("*** AdTapsy Ad Shown ***");
} else if(code == cocos2d::plugin::AdsResultCode::kAdsDismissed) {
CCLOG("*** AdTapsy Ad Dismissed ***");
} else if(code == cocos2d::plugin::AdsResultCode::kUnknownError) {
CCLOG("*** AdTapsy Ad Failed To Show");
} else if(code == cocos2d::plugin::AdsResultCode::kAdsReceived) {
CCLOG("*** AdTapsy Ad Loaded***");
}
}
void onPlayerGetPoints(cocos2d::plugin::ProtocolAds* pAdsPlugin, int points)
{
CCLOG("*** AdTapsy Reward Received***");
}
};
And pass it to adtapsy->setAdsListener(AdsListener* listener);
cocos2d::plugin::AdsListener* listener = new MyAdsListener();
adtapsy->setAdsListener(listener);
You can change the default reward, the user ID for server-side callbacks and enable popups
cocos2d::plugin::PluginParam rewardAmount(10);
adtapsy-> callFuncWithParam("setRewardedVideoAmount", &rewardAmount, NULL);
cocos2d::plugin::PluginParam userId("userId");
adtapsy-> callFuncWithParam("setUserIdentifier", &userId, NULL);
cocos2d::plugin::PluginParam showPrePopup(false);
adtapsy-> callFuncWithParam("setRewardedVideoPrePopupEnabled", &showPrePopup, NULL);
cocos2d::plugin::PluginParam showPostPopup(false);
adtapsy-> callFuncWithParam("setRewardedVideoPostPopupEnabled", &showPostPopup, NULL);