InMobi / sdk-sample-code-android

This repository contains InMobi Android SDK sample code for different ad-formats, which publishers can use to incorporate in their apps — Edit
Apache License 2.0
38 stars 43 forks source link

Test Ads showing but Real Ads not Showing #79

Closed adit50 closed 2 years ago

adit50 commented 3 years ago

Hi, I have integrated Banner Ads. And test ads are showing, but when I turn OFF test mode, it doesn't show any ad and throw an error in logcat -

D/[InMobi]: Failed to fetch ad for placement id: 1618895541320, reason phrase available in onAdLoadFailed callback. D/InMobi: Banner ad failed to load with error: Ad request successful but no ad served.

XML Code -

<com.inmobi.ads.InMobiBanner
        android:id="@+id/ad_view"
        android:layout_width="320dp"
        android:layout_height="50dp"
        ads:placementId="plid-1618895541320"
        ads:refreshInterval="20"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        />

Kotlin Code -

ad_view.setAnimationType(InMobiBanner.AnimationType.ROTATE_HORIZONTAL_AXIS)

        var bannerAdEventListener: BannerAdEventListener = object: BannerAdEventListener() {

            override fun onAdLoadSucceeded(inMobiBanner: InMobiBanner,
                                           adMetaInfo: AdMetaInfo) {
                Log.d("InMobi", "onAdLoadSucceeded with bid " + adMetaInfo.getBid())
            }
            override fun onAdLoadFailed(inMobiBanner: InMobiBanner, inMobiAdRequestStatus: InMobiAdRequestStatus) {
                Log.d("InMobi", "Banner ad failed to load with error: " +
                        inMobiAdRequestStatus.getMessage())
            }
            override fun onAdClicked(inMobiBanner: InMobiBanner, p1: MutableMap<Any, Any>?) {
                Log.d("InMobi", "onAdClicked")
            }
            override fun onAdDisplayed(inMobiBanner: InMobiBanner) {
                Log.d("InMobi", "onAdDisplayed")
            }
            override fun onAdDismissed(inMobiBanner: InMobiBanner) {
                Log.d("InMobi", "onAdDismissed")
            }
            override fun onUserLeftApplication(inMobiBanner: InMobiBanner) {
                Log.d("InMobi", "onUserLeftApplication")
            }
            override fun onRewardsUnlocked(inMobiBanner: InMobiBanner, p1: MutableMap<Any, Any>?) {
                Log.d("InMobi", "onRewardsUnlocked")
            }
        }

        ad_view.setListener(bannerAdEventListener)
        ad_view.load()

Kindly please check.

Thanks & Regards, Aditya Raj

RajSuvariya-InMobi commented 3 years ago

Hi @adit50

There is nothing wrong with your implementation if test ads are showing. When you keep the test mode on, InMobi serves test ads all the time but when you turn it off, InMobi will actually try and find an advertiser who is willing to show an ad to you considering lot of parameters like your locality, region, your interest etc. But if no advertisers are willing to show an ad on your device then InMobi will fail the request with "Ad request successful but no ad served."

But this doesn't mean that in production you will not see ads. As user changes above parameters changes and you will start getting ads. You can track below this on InMobi dashboard.

sunilkuna5-inmobi commented 2 years ago

Closing the issue as there is no follow up on the query @adit50