Android Question Admob Rewarded Video - Events do not work

marcelo_efn

Member
Licensed User
Longtime User
HI,

I followed all the steps in the AdMob Mediation (with InMobi) tutorial, but my App does not respond to any events after viewing the Rewarded Video.

The video is displayed but the Ad_Rewarded event is not called.

Can @Erel or anyone tell me what might be wrong???
 

marcelo_efn

Member
Licensed User
Longtime User
Hi @Erel

The application normally displays the video but does not call the Ad_Rewarded event or any other.
Does not display errors messages.
Library FirebaseAdMob is enabled in the project.


This is the code:

B4X:
Sub Process_Globals
End Sub

Sub Globals
    Private ad As RewardedVideoAd
End Sub

Sub Activity_Create(FirstTime As Boolean)
    ad.Initialize("Vd Rewarded")
End Sub

Sub Activity_Resume
    ad.LoadAd("ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx")
End Sub

Sub Activity_Click
   If ad.Ready Then ad.Show
End Sub

Sub Ad_Rewarded (Item As Object)
   ToastMessageShow("You are rewarded!!!", True)
End Sub

Sub ad_ReceiveAd
   Log("Ad received. Now wait for the right moment to show the ad.")
   ToastMessageShow("Received",False)
End Sub

Sub Ad_FailedToReceiveAd (ErrorCode As String)
  Log("Failed: " & ErrorCode)
End Sub

Sub Ad_AdOpened
   Log("Opened")
End Sub

Sub Ad_AdClosed
   Log("Closed")
End Sub

Manifest code:

B4X:
AddApplicationText( 
   <atividade android:name="com.google.android.gms.common.api.GoogleApiActivity" 
  android:theme="@android:style/Theme.Translucent.NoTitleBar" 
  android:exported="false"/> 
    <meta-data 
  android:name="com.google.android.gms.version" 
  android:value="@integer/google_play_services_version"/> 
)
'************ Firebase Base ************
CreateResourceFromFile("google-services", "google-services.json")
AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.INTERNET)
AddPermission(android.permission.WAKE_LOCK)
AddPermission(com.google.android.c2dm.permission.RECEIVE)
AddPermission(${applicationId}.permission.C2D_MESSAGE)
AddManifestText( <permission android:name="${applicationId}.permission.C2D_MESSAGE"
  android:protectionLevel="signature" />)
AddApplicationText(
<receiver
  android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
  android:enabled="true">
  <intent-filter>
  <action android:name="com.google.android.gms.measurement.UPLOAD"/>
  </intent-filter>
  </receiver>

  <service
  android:name="com.google.android.gms.measurement.AppMeasurementService"
  android:enabled="true"
  android:exported="false"/>
   <provider
  android:authorities="${applicationId}.firebaseinitprovider"
  android:name="com.google.firebase.provider.FirebaseInitProvider"
  android:exported="false"
  android:initOrder="100" />
    <receiver
  android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
  android:enabled="true">
  <intent-filter>
  <action android:name="com.google.android.gms.measurement.UPLOAD"/>
  </intent-filter>
  </receiver>

  <service
  android:name="com.google.android.gms.measurement.AppMeasurementService"
  android:enabled="true"
  android:exported="false"/>
   <receiver
  android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
  android:exported="true"
  android:permission="com.google.android.c2dm.permission.SEND" >
  <intent-filter>
  <action android:name="com.google.android.c2dm.intent.RECEIVE" />
  <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
  <category android:name="${applicationId}" />
  </intent-filter>
  </receiver>
    <receiver
  android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
  android:exported="false" />


  <service
  android:name="com.google.firebase.iid.FirebaseInstanceIdService"
  android:exported="true">
  <intent-filter android:priority="-500">
  <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
  </intent-filter>
  </service>
)
'************ Firebase Base (end) ************
'************ Firebase Ads ************
AddApplicationText(
  <activity
  android:name="com.google.android.gms.ads.AdActivity"
  android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
  android:theme="@android:style/Theme.Translucent" />
  <activity android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity"
  android:theme="@style/Theme.IAPTheme"/>
)
'************ Firebase Ads (end) ************
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
ad.Initialize("Vd Rewarded")
are you sure this line is correct?

I do not use ads but usually you need to initialize libs with an Event prefix.

Maybe
B4X:
ad.Initialize("Ad")
 
Upvote 0
Top