how to find when ad has been closed Revmob cocos2Dx

193 Views Asked by At

I'm trying to implement Revmob into my cocos2Dx game and I need to check that the ad has been closed but there is no documentation on how to do that. Does anyone know how to see if the ad has closed?

I also saw a mention to a listener in the documentation on Revmob however the link they provide goes nowhere.I noticed that it outputs a few lines to my log that look different from the standard logs that my game has are these what I need to listen for?

2013-08-22 17:36:15.957 MyGame[2094:c07] [RevMob] Ad received: (200).
2013-08-22 17:36:35.075 MyGame[2094:c07] [RevMob] Fullscreen closed
1

There are 1 best solutions below

0
On

I need to check that the ad has been closed

Revmob offers an option to pass custom delegate when launching:

RevMobAds.h:

+ (RevMobAds *)startSessionWithAppID:(NSString *)anAppId andDelegate:(id<RevMobAdsDelegate>)adelegate;

The RevMobAdsDelegate allows you to implement a function, which would be called when the ad gets closed by user (which is what you want).

RevMobAdsDelegate.h:

/**
Fired by Fullscreen and popup.
*/
- (void)revmobUserClosedTheAd;

Basically you want to implement that delegate callback and you are set.

Personally I prefer to make my AppController implement the required delegate protocol (in your case - RevMobAdsDelegate): AppController.h:

@interface AppController : NSObject <UIApplicationDelegate, RevMobAdsDelegate>

And then, in AppController.mm:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[RevMobAds startSessionWithAppID:@"your RevMob ID" andDelegate:self];

// your initialization code here
// ...

return YES;
}

- (void)revmobUserClosedTheAd{
//your custom logic
}

Hope that helps.