Android Question Admob test mode

DarkSmart

Member
Licensed User
hi
How use test mode in firebase admob??
Because i use emulator and ads not show
I need test mode for test banner size and etc
 

DarkSmart

Member
Licensed User
Call AdView.LoadAdWithTestDevice.
not worked!
i get device id from log:
Use AdRequest.Builder.addTestDevice("CAD8007B065E0B86EF3C52DFD5558E21") to get test ads on this device.
CAD8007B065E0B86EF3C52DFD5558E21
And use this code for show test ads:
B4X:
Sub Globals
    Private BannerAd As AdView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    BannerAd.Initialize2("BannerAd", "ca-app-pub-3940256099942544/6300978111", BannerAd.SIZE_SMART_BANNER)
    Activity.AddView(BannerAd, 10%x, 0, 80%x, 20%y)
    BannerAd.LoadAdWithTestDevice("CAD8007B065E0B86EF3C52DFD5558E21")
End Sub

Sub BannerAd_AdScreenDismissed
    Log("BannerAd_AdScreenDismissed")
End Sub

Sub BannerAd_FailedToReceiveAd (ErrorCode As String)
    Log("BannerAd_FailedToReceiveAd : "&ErrorCode)
End Sub

Sub BannerAd_PresentScreen
    Log("BannerAd_PresentScreen")
End Sub

Sub BannerAd_ReceiveAd
    Log("BannerAd_ReceiveAd")
End Sub
but not work and not show any thing
Also write error code zero in log after one minute!
Log:
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
BannerAd_FailedToReceiveAd : 0
What problem?
 

DarkSmart

Member
Licensed User
not worked!
i get device id from log:


And use this code for show test ads:
B4X:
Sub Globals
    Private BannerAd As AdView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    BannerAd.Initialize2("BannerAd", "ca-app-pub-3940256099942544/6300978111", BannerAd.SIZE_SMART_BANNER)
    Activity.AddView(BannerAd, 10%x, 0, 80%x, 20%y)
    BannerAd.LoadAdWithTestDevice("CAD8007B065E0B86EF3C52DFD5558E21")
End Sub

Sub BannerAd_AdScreenDismissed
    Log("BannerAd_AdScreenDismissed")
End Sub

Sub BannerAd_FailedToReceiveAd (ErrorCode As String)
    Log("BannerAd_FailedToReceiveAd : "&ErrorCode)
End Sub

Sub BannerAd_PresentScreen
    Log("BannerAd_PresentScreen")
End Sub

Sub BannerAd_ReceiveAd
    Log("BannerAd_ReceiveAd")
End Sub
but not work and not show any thing
Also write error code zero in log after one minute!
Log:

What problem?
this my manifest code:
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseAdMob.FirebaseAds)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.DarkTheme)
AddPermission(android.permission.INTERNET)
i use b4a 9.0 and api 29
also i attached sdk manager screenshot (please see)

sdk1.jpg
sdk2.jpg
sdk3.jpg
 
Top