1

In my application I'm using ads for tvOS. I have tried using the AppLovin SDK for ad implementation but it shows a full screen ad.

I want to show a banner view like scrolling data update in my tvOS app. Can I achieve this with iAd or AdMob on tvOS?

I'm using

ALSdk.shared()!.adService.loadNextAd(ALAdSize.sizeInterstitial(), andNotify: self)

to load ads.

Then, once an ad is available I'm showing the ad using:

ALInterstitialAd.shared().adDisplayDelegate = self
ALInterstitialAd.shared().adVideoPlaybackDelegate = self

if let ad = self.ad
{            
    ALInterstitialAd.shared().showOver(UIApplication.sharedApplication().keyWindow!, andRender: ad)
}
Daniel Storm
  • 18,301
  • 9
  • 84
  • 152
Bhargavi
  • 75
  • 6

2 Answers2

1

As Daniel Storm said, banner ads don't really make sense on a tv. But if you insist, you can create your own banners natively.

For example, in your view controller:

@interface ALDemoNativeAdProgrammaticViewController ()<ALNativeAdLoadDelegate, ALNativeAdPrecacheDelegate, ALPostbackDelegate>
@property (nonatomic, strong) ALNativeAd *nativeAd;
@end

- (void)viewDidLoad
{
  [super viewDidLoad];
  [[ALSdk shared].nativeAdService loadNativeAdGroupOfCount: 1 andNotify: self];
}

#pragma mark - Native Ad Load Delegate

- (void)nativeAdService:(nonnull ALNativeAdService *)service didLoadAds:(nonnull NSArray *)ads
{
    // At this point, the native ad is loaded, but assets not retrieved yet.
    self.nativeAd = [ads firstObject];

    // You can use AppLovin's pre-caching to retrieve assets (app icon, ad image, ad video) locally. OR you can do it with your preferred caching framework.
    // iconURL, imageURL, videoURL needs to be retrieved manually before you can render them. For our example, we'll use AppLovin's caching framework.
    [[ALSdk shared].nativeAdService precacheResourcesForNativeAd: self.nativeAd andNotify: self];
}

- (void)nativeAdService:(nonnull ALNativeAdService *)service didFailToLoadAdsWithError:(NSInteger)code
{
  // Handle error
}

#pragma mark - Native Ad Precache Delegate

- (void)nativeAdService:(nonnull ALNativeAdService *)service didPrecacheImagesForAd:(nonnull ALNativeAd *)ad { }

- (void)nativeAdService:(nonnull ALNativeAdService *)service didPrecacheVideoForAd:(nonnull ALNativeAd *)ad
{
    // This delegate method will get called whether an ad actually has a video to precache or not
    //
    // FINALLY, perform whatever view logic you want with the assets provided in your ALNativeAd property, and show the ad.
}

- (void)nativeAdService:(nonnull ALNativeAdService *)service didFailToPrecacheImagesForAd:(nonnull ALNativeAd *)ad withError:(NSInteger)errorCode 
{
  // Handle error
}

- (void)nativeAdService:(nonnull ALNativeAdService *)service didFailToPrecacheVideoForAd:(nonnull ALNativeAd *)ad withError:(NSInteger)errorCode 
{
  // Handle error
}

Note that AppLovin's callbacks are not guanranteed to be invoked on the main queue.

It is also your responsibility to track your own impressions

[[ALSdk shared].postbackService dispatchPostbackAsync: ad.impressionTrackingURL andNotify: self];

and launch the App store when clicked

 [self.nativeAd launchClickTarget];
Thomas Elliot
  • 659
  • 8
  • 12
0

iAd does not support tvOS and is being discontinued, AdMob does not support tvOS also, and AppLovin only supports full screen interstitial ads on tvOS. So, as of now banner ads are not possible on tvOS. I wouldn't anticipate them becoming available anytime soon either seeing as banner ads wouldn't make much sense on a TV.

Daniel Storm
  • 18,301
  • 9
  • 84
  • 152