iOS Question The test ad does not appear in RewardedVideoAd. What is the problem?

Modern_Digital

Member
Licensed User
Longtime User
Hi,

The test ad does not appear in RewardedVideoAd, This is what I did in my B4i project :

- I created a new RewardAd unit in my google AdMob account.
- I have added the iAdMob library version 3.00 to the project.
- I defined this variable :

B4X:
Private RVA As RewardedVideoAd
in Sub Process_Globals.

- I added variable events :

B4X:
Private Sub RVA_AdClosed
    Log("AdClosed")
End Sub

Private Sub RVA_AdOpened
    Log("AdOpened")
End Sub

Private Sub RVA_FailedToReceiveAd (ErrorCode As String)
    Log("FailedToReceiveAd = " & ErrorCode)
End Sub

Private Sub RVA__ReceiveAd
    Log("ReceiveAd")
    RVA.Show(Page1)
End Sub

Private Sub RVA_Rewarded (Item As Object)
    Log("Rewarded")
End Sub

- This is the button click event code :

B4X:
Private Sub Button1_Click

    Try
    
        'Test Ads IDs:
        'App Open                = ca-App-pub-3940256099942544/5662855259
        'Adaptive Banner        = ca-App-pub-3940256099942544/2435281174
        'Banner                    = ca-App-pub-3940256099942544/2934735716
        'Interstitial            = ca-App-pub-3940256099942544/4411468910
        'Interstitial Video        = ca-App-pub-3940256099942544/5135589807
        'Rewarded                = ca-App-pub-3940256099942544/1712485313
        'Rewarded Interstitial    = ca-App-pub-3940256099942544/6978759866
        'Native Advanced        = ca-App-pub-3940256099942544/3986624511
        'Native Advanced Video    = ca-App-pub-3940256099942544/2521693316
        
        Dim oIDFA As NativeObject = Me
        oIDFA.RunMethod("requestIDFA", Null)
        Wait For GAD_TrackingAuthorization (Status As Int)                               
        
        Dim ARB As AdRequestBuilder

        If Status = 0 Then
           Return
        Else
           ARB.Initialize
           If Status <> 3 Then ARB.NonPersonalizedAds
        End If           

        RVA.LoadAdWithBuilder("ca-App-pub-3940256099942544/1712485313", ARB)

        Return

    Catch
        
         'Log(LastException)
        
         Return
        
    End Try     
        
End Sub

- This is OBJC inline code :

B4X:
#if OBJC
#import <AppTrackingTransparency/AppTrackingTransparency.h>
#import <AdSupport/AdSupport.h>
- (void)requestIDFA {
    if (@available(iOS 14, *)) {
      [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
          [self.bi raiseUIEvent:nil event:@"gad_trackingauthorization:" params:@[@(status)]];
      }];
  } else {
          [self.bi raiseUIEvent:nil event:@"gad_trackingauthorization:" params:@[@(3)]];
    }
 
}

#End If

Q1 : I don't know what the problem is or what else I need to do to make the ad appear?
Q2 : After the user finishes watching the ad video, I want to use server-side verification. How do I do that in the iAdMob Library?

Thank you.
 
Solution
Thank you Erel, I solved the second question this way and everything works fine, This is the whole code :

B4X:
'Code module
#Region  Project Attributes
    #ApplicationLabel: RewardedAds
    #Version: 1.0
    'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
    #iPhoneOrientations: Portrait
    #iPadOrientations: Portrait
    #Target: iPhone, iPad
    #ATSEnabled: True
    #MinVersion: 12
    #PlistExtra: <key>GADIsAdManagerApp</key><true/>
    #AdditionalLib: libsqlite3.dylib
    #AdditionalLib: libz.dylib
    #AdditionalLib: WebKit.framework
    #AdditionalLib: AppTrackingTransparency.framework
    #PlistExtra: <key>NSUserTrackingUsageDescription</key><string>This identifier will be used To...

Modern_Digital

Member
Licensed User
Longtime User
I would like to mention that I first used the test ad unit ID, and then this appeared in the log:
B4X:
<Google> To get test ads on this device, set:
Objective-C
    GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers = @[ @"*****" ];
Swift
    GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [ @"*****" ]
<Google> Invalid Request. Cannot determine request Type. Is your ad unit id correct?
RVA_FailedToReceiveAd = Error Domain=com.google.admob Code=0 "Cannot determine request type. Is your ad unit id correct?" UserInfo={NSLocalizedDescription=Cannot determine request Type. Is your ad unit id correct?, gad_response_info=  ** Response Info **
    Response ID: (Null)
    Network: (Null)
  ** Mediation line items **
}

Note : I changed the appeared device test id with ***** just here for the post.

Then I added the test device ID with this inline code :

B4X:
        Dim No As NativeObject = Me
        Dim oMobileAdsSharedInstance As NativeObject       
        oMobileAdsSharedInstance.Initialize("GADMobileAds")   
        oMobileAdsSharedInstance = oMobileAdsSharedInstance.RunMethod("sharedInstance", Null)
        No.RunMethod("setTestDeviceID::", Array(oMobileAdsSharedInstance, TestDeviceID))

B4X:
#if OBJC
#import <GoogleMobileAds/GoogleMobileAds.h>
- (void)setTestDeviceID:(GADMobileAds *) gSharedInstance :(NSString *) gTestDeviceID {
   gSharedInstance.requestConfiguration.testDeviceIdentifiers = @[gTestDeviceID];
}
#End If

Then this appeared to me in the log :

B4X:
<Google> Invalid Request. Cannot determine request Type. Is your ad unit id correct?
RVA_FailedToReceiveAd = Error Domain=com.google.admob Code=0 "Cannot determine request type. Is your ad unit id correct?" UserInfo={NSLocalizedDescription=Cannot determine request Type. Is your ad unit id correct?, gad_response_info=  ** Response Info **
    Response ID: (Null)
    Network: (Null)
  ** Mediation line items **
}

Then I changed the test ad unit ID with other test ad unit ID, this :
B4X:
/6499/example/rewarded
, and then no log appeared and no ad appeared.

Then I changed the test ad unit ID with the original ad unit ID from my account in admob, and then no log appeared and no ad appeared.
 
Upvote 0

Modern_Digital

Member
Licensed User
Longtime User
Thank you Erel, I solved the second question this way and everything works fine, This is the whole code :

B4X:
'Code module
#Region  Project Attributes
    #ApplicationLabel: RewardedAds
    #Version: 1.0
    'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
    #iPhoneOrientations: Portrait
    #iPadOrientations: Portrait
    #Target: iPhone, iPad
    #ATSEnabled: True
    #MinVersion: 12
    #PlistExtra: <key>GADIsAdManagerApp</key><true/>
    #AdditionalLib: libsqlite3.dylib
    #AdditionalLib: libz.dylib
    #AdditionalLib: WebKit.framework
    #AdditionalLib: AppTrackingTransparency.framework
    #PlistExtra: <key>NSUserTrackingUsageDescription</key><string>This identifier will be used To deliver personalized ads To you.</string>
    #PlistExtra:<key>SKAdNetworkItems</key>
    #PlistExtra:   <array>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>cstr6suwn9.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>4fzdc2evr5.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>4pfyvq9l8r.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>2fnua5tdw4.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>ydx93a7ass.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>5a6flpkh64.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>p78axxw29g.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>v72qych5uu.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>ludvb6z3bs.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>cp8zw746q7.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>c6k4g5qg8m.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>s39g8k73mm.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>3qy4746246.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>3sh42y64q3.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>f38h382jlk.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>hs6bdukanm.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>prcb7njmu6.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>v4nxqhlyqp.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>wzmmz9fp6w.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>yclnxrl5pm.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>t38b2kh725.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>7ug5zh24hu.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>9rd848q2bz.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>vutu7akeur.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>y5ghdn5j9k.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>n6fk4nfna4.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>v9wttpbfk9.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>n38lu8286q.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>47vhws6wlr.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>kbd757ywx3.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>9t245vhmpl.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>eh6m2bh4zr.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>a2p9lx4jpn.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>22mmun2rn5.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>4468km3ulz.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>2u9pt9hc89.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>8s468mfl3y.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>av6w8kgt66.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>klf5c3l5u5.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>ppxm28t8ap.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>424m5254lk.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>ecpz2srf59.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>uw77j35x4d.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>pwa73g5rt2.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>mlmmfzh3r3.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>578prtvx9j.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>4dzt52r2t5.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>gta9lk7p23.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>e5fvkxwrpn.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>8c4e2ghe7u.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>zq492l623r.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>3rd42ekr43.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:     <dict>
    #PlistExtra:       <key>SKAdNetworkIdentifier</key>
    #PlistExtra:       <string>3qcr597p9d.skadnetwork</string>
    #PlistExtra:     </dict>
    #PlistExtra:   </array>
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public App As Application
    Public NavControl As NavigationController
    Private Page1 As Page  
    Private oRVA As NativeObject
End Sub

Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.RootPanel.LoadLayout("Page1")
    NavControl.ShowPage(Page1)
    SetTestAdDeviceID("Your device test id that appear in the log")
End Sub

Sub Button1_Click
LoadNewRewardedVideoAd
End Sub

Private Sub RVA_AdOpened
    Log("RVA_AdOpened")
End Sub

Private Sub RVA_AdClosed
    Log("RVA_AdClosed")
    ShowHideStatusBar(False)
End Sub

Private Sub RVA_FailedToOpen
    Log("RVA_FailedToOpen")
End Sub

Sub RVA_FailedToLoad (ErrorCode As Int, ErrorDescription As String)
    Log("RVA_FailedToLoad")
    Log("ErrorCode = " & ErrorCode)
    Log("ErrorDescription =" & ErrorDescription)
End Sub

Sub RVA_Loaded (RewardedAd As RewardedVideoAd)

    Log("RVA_Loaded")
   
    Dim oBlock As NativeObject = Me
    Dim UserID As String = "[email protected]"
    Dim CustomData As String = "Some Data"
           
    oBlock = oBlock.RunMethod("getUserDidEarnRewardHandlerBlock", Null)

    oRVA = RewardedAd
   
    Dim oReward As NativeObject = oRVA.GetField("adReward")
   
    Log("Type = " & oReward.GetField("type").AsString)
    Log("amount = " & oReward.GetField("amount").AsNumber)
   
    SetServerSideVerificationOptions(oRVA, UserID.Trim, CustomData.Trim)
    
    ShowHideStatusBar(True)

    oRVA.SetField("fullScreenContentDelegate", Page1)
   
    oRVA.RunMethodWithBlocks("presentFromRootViewController:userDidEarnRewardHandler:", Array(Page1, oBlock))
   
End Sub

Private Sub RVA_Rewarded
    Log("RVA_Rewarded")
End Sub

Private Sub SetTestAdDeviceID (TestDeviceID As String)

    Dim DeviceIdentifiers As NativeObject = Me
    Dim oMobileAdsSharedInstance As NativeObject
   
    DeviceIdentifiers = DeviceIdentifiers.RunMethod("createNativeArray:", Array(TestDeviceID))
   
    oMobileAdsSharedInstance.Initialize("GADMobileAds")
    oMobileAdsSharedInstance.RunMethod("sharedInstance", Null).RunMethod("requestConfiguration", Null).SetField("testDeviceIdentifiers", DeviceIdentifiers)

End Sub

Private Sub SetServerSideVerificationOptions (RewardedAd As NativeObject, lvUserIdentifier As String, lvCustomData As String)

        Dim oOptions As NativeObject
       
        oOptions = oOptions.Initialize("GADServerSideVerificationOptions").RunMethod("alloc",Null)
        If lvUserIdentifier.Trim <> "" Then oOptions.SetField("userIdentifier", lvUserIdentifier)
        If lvCustomData.Trim <> "" Then oOptions.SetField("customRewardString", lvCustomData)
       
        RewardedAd.SetField("serverSideVerificationOptions", oOptions)
       
End Sub

Private Sub LoadNewRewardedVideoAd As ResumableSub

    Try

        Dim oIDFA As NativeObject = Me      
        Dim ARB As AdRequestBuilder
        Dim oRewaredAd As NativeObject
        Dim oBlock As NativeObject = Me
                       
        oIDFA.RunMethod("requestIDFA", Null)
        Wait For GAD_TrackingAuthorization (Status As Int)  
                                                               
        If ARB.IsInitialized = False Then ARB.Initialize      
        If Status <> 3 Then    ARB.NonPersonalizedAds
       
        oBlock = oBlock.RunMethod("getRewardedAdLoadCompletionHandlerBlock", Null)
               
        oRewaredAd = oRewaredAd.Initialize("GADRewardedAd").RunMethodWithBlocks("loadWithAdUnitID:request:completionHandler:", Array("Your real rewarded ad unit id", ARB, oBlock))
       
        Return "OK"

    Catch
       
         Log(LastException)
                 
         Return "Error"
       
    End Try    
       
End Sub

Private Sub ShowHideStatusBar(ShowHide As Boolean)    
    Dim No As NativeObject = App        
    No.RunMethod("setStatusBarHidden:animated:", Array(ShowHide, False))
End Sub

#if OBJC

#import <UserNotifications/UserNotifications.h>
#import <AppTrackingTransparency/AppTrackingTransparency.h>
#import <AdSupport/AdSupport.h>

- (void)requestIDFA {
    if (@available(iOS 14, *)) {
      [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
          [self.bi raiseUIEvent:nil event:@"gad_trackingauthorization:" params:@[@(status)]];
      }];
  } else {
          [self.bi raiseUIEvent:nil event:@"gad_trackingauthorization:" params:@[@(3)]];
    }
 
}

GADRewardedAdLoadCompletionHandler rewardedAdLoadCompletionHandlerBlock = ^(GADRewardedAd *ad, NSError *error) {
   
    __block B4I* bi = [b4i_main new].bi;
    __block B4IRewardedVideoAd *rewardedAd = [[B4IRewardedVideoAd alloc] init];
       
    if (error) {
      [bi raiseUIEvent:nil event:@"rva_failedtoload::" params:@[@([error code]),[error localizedDescription]]];
      return;
    }
   
    rewardedAd.object = ad;
    [bi raiseUIEvent:nil event:@"rva_loaded:" params:@[rewardedAd]];
   
};
       
- (NSObject *)getRewardedAdLoadCompletionHandlerBlock {
    return rewardedAdLoadCompletionHandlerBlock;
}


GADUserDidEarnRewardHandler userDidEarnRewardHandlerBlock = ^{
   
    __block B4I* bi = [b4i_main new].bi;
   
    [bi raiseUIEvent:nil event:@"rva_rewarded" params:nil];
   
};
       
- (NSObject *)getUserDidEarnRewardHandlerBlock {
    return userDidEarnRewardHandlerBlock;
}


- (NSArray *)createNativeArray:(NSString *) nArrayItem {
    NSArray *array = @[nArrayItem];
    return array;
}

#End If

#if OBJC

@end
@interface GADRewardedAd (event)
@end
@implementation GADRewardedAd (event)

/// Tells the delegate that the ad failed to present full screen content.
- (void)ad:(nonnull id<GADFullScreenPresentingAd>)ad
    didFailToPresentFullScreenContentWithError:(nonnull NSError *)error {
    B4I* bi = [b4i_main new].bi;
    [bi raiseEvent:nil event:@"rva_failedtoopen" params:nil];
}

/// Tells the delegate that the ad will present full screen content.
- (void)adWillPresentFullScreenContent:(nonnull id<GADFullScreenPresentingAd>)ad {
    B4I* bi = [b4i_main new].bi;
    [bi raiseEvent:nil event:@"rva_adopened" params:nil];
}

/// Tells the delegate that the ad dismissed full screen content.
- (void)adDidDismissFullScreenContent:(nonnull id<GADFullScreenPresentingAd>)ad {
    B4I* bi = [b4i_main new].bi;
    [bi raiseEvent:nil event:@"rva_adclosed" params:nil];
}

#End If
 
Last edited:
Upvote 1
Solution
Top