Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

glossom-dev/AdColony_webview_support_ios

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Supporting Adcolony ads with WebView applications

In order to support Adcolony ads within a WebView in native mobile applications, changes need to be made to have the application call Adcolony SDK to show Ads from links in webview.

iOS

With iOS, the delegate for the webview needs to be set:

_webview.delegate = self;

Then the webView:shouldStartLoadWithRequest:navigationType: delegate method needs to be implemented so that it handles the links which you defined to trigger video:

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
  NSURL *requestURL = [request URL];

  if ([self showAdcolony:request]) {
    [[UIApplication sharedApplication] openURL:requestURL];
    return NO;
  }
  return YES;
}

-(BOOL)showAdcolony:(NSURLRequest *)request{
  if ([ request.URL.scheme isEqualToString:@"adcolony" ]) {
    [AdColony playVideoAdForZone:@"vzf8e4e97704c4445c87504e" withDelegate:nil withV4VCPrePopup:YES andV4VCPostPopup:YES];
    return YES;
  }
  
  return NO;
}

About

adcolony webview support for ios

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published