clockbyte / admobadapter

It wraps your Adapter to display Admob native ads and banners in a ListView/RecyclerView data set. It based on the Yahoo fetchr project https://github.com/yahoo/fetchr
Apache License 2.0
237 stars 75 forks source link

Banner ad are not loaded #124

Open Hasan-Mahmud opened 6 years ago

Hasan-Mahmud commented 6 years ago

I want to show banner ad in my RecyclerView by using AdmobBannerRecyclerAdapterWrapper But blank ad view are showing no ad are loading the code is adapterWrapper = AdmobBannerRecyclerAdapterWrapper.builder(this) .setAdapter(mVideoAdapter) .setSingleAdUnitId(adMobUnitId) .setNoOfDataBetweenAds(3) .setFirstAdIndex(3) .setLimitOfAds(5) .setTestDeviceIds(deviceIds) .build(); what is the problem i can't understand help please

kot331107 commented 6 years ago

@Hasan-Mahmud please send your LogCat filtered with "ads"

Hasan-Mahmud commented 6 years ago

@kot331107 07-12 16:48:14.894 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: Scheduling ad refresh 60000 milliseconds from now. 07-12 16:48:15.054 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: Starting ad request. 07-12 16:48:15.064 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: Use AdRequest.Builder.addTestDevice("D557F4B7EAE8CD020E0E79380D8E76DC") to get test ads on this device. 07-12 16:48:15.415 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: Starting ad request. 07-12 16:48:15.415 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: Use AdRequest.Builder.addTestDevice("D557F4B7EAE8CD020E0E79380D8E76DC") to get test ads on this device. 07-12 16:48:15.415 31812-31812/com.greypixelapps.guide.clashofclans W/Ads: Not retrying to fetch app settings 07-12 16:48:17.207 32006-32006/? I/DownloadManager: DownloadService onCreate 07-12 16:48:17.217 32006-32006/? I/DownloadManager: DownloadService onStartCommand 07-12 16:48:17.227 32006-32441/? I/DownloadManager: DownloadService updating for startId 1 07-12 16:48:17.307 32006-32441/? I/DownloadManager: DownloadService inserdDownloadLocked 1 07-12 16:48:17.337 32006-32441/? I/DownloadManager: DownloadService inserdDownloadLocked 9 07-12 16:48:17.367 32006-32006/? I/DownloadManager: DownloadService onDestroy 07-12 16:48:17.377 32006-32441/? I/DownloadManager: DownloadService Nothing left stopped startId 1 07-12 16:48:20.380 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: Scheduling ad refresh 70000 milliseconds from now. 07-12 16:48:20.410 31812-31812/com.greypixelapps.guide.clashofclans I/dalvikvm: Could not find method android.os.PowerManager.isInteractive, referenced from method com.google.android.gms.ads.internal.activeview.c.g 07-12 16:48:20.590 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: Ad finished loading. 07-12 16:48:20.700 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: Ad finished loading. 07-12 16:48:21.000 31812-32535/com.greypixelapps.guide.clashofclans I/System.out: 07-12 16:48:23.082 31812-31812/com.greypixelapps.guide.clashofclans D/DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraMobileAdsSettingManagerCreatorImpl 07-12 16:48:23.132 31812-31812/com.greypixelapps.guide.clashofclans D/DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl 07-12 16:48:23.172 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: Starting ad request. 07-12 16:48:23.172 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: Use AdRequest.Builder.addTestDevice("D557F4B7EAE8CD020E0E79380D8E76DC") to get test ads on this device. 07-12 16:48:23.182 31812-31812/com.greypixelapps.guide.clashofclans W/Ads: Not retrying to fetch app settings 07-12 16:48:23.413 14286-32033/? W/Ads: App does not have the required permissions to get location 07-12 16:48:23.523 31812-31812/com.greypixelapps.guide.clashofclans I/com.clockbyte.admobadapter.bannerads.AdmobFetcherBanner: Fetching Ad now 07-12 16:48:23.523 31812-31812/com.greypixelapps.guide.clashofclans I/com.clockbyte.admobadapter.bannerads.AdmobFetcherBanner: Fetching Ad now 07-12 16:48:23.893 31812-31812/com.greypixelapps.guide.clashofclans D/DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl 07-12 16:48:23.903 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: Starting ad request. 07-12 16:48:23.903 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: This request is sent from a test device. 07-12 16:48:23.903 31812-31812/com.greypixelapps.guide.clashofclans W/Ads: Not retrying to fetch app settings 07-12 16:48:23.933 31812-31812/com.greypixelapps.guide.clashofclans D/DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl 07-12 16:48:23.943 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: Starting ad request. 07-12 16:48:23.943 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: This request is sent from a test device. 07-12 16:48:23.943 31812-31812/com.greypixelapps.guide.clashofclans W/Ads: Not retrying to fetch app settings 07-12 16:48:24.033 14286-32036/? W/Ads: App does not have the required permissions to get location 07-12 16:48:24.303 14286-32421/? W/Ads: App does not have the required permissions to get location 07-12 16:48:25.685 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: Scheduling ad refresh 70000 milliseconds from now. 07-12 16:48:25.715 31812-31812/com.greypixelapps.guide.clashofclans I/DynamiteModule: Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:290 07-12 16:48:25.715 31812-31812/com.greypixelapps.guide.clashofclans I/DynamiteModule: Selected remote version of com.google.android.gms.ads.dynamite, version >= 290 07-12 16:48:25.765 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: Ad finished loading. 07-12 16:48:25.765 31812-31812/com.greypixelapps.guide.clashofclans I/com.clockbyte.admobadapter.bannerads.AdmobFetcherBanner: onAdFetched 07-12 16:48:25.805 31812-31812/com.greypixelapps.guide.clashofclans W/Ads: Not enough space to show ad. Needs 320x50 dp, but only has 313x50 dp. 07-12 16:48:26.225 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: Scheduling ad refresh 70000 milliseconds from now. 07-12 16:48:26.235 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: Ad finished loading. 07-12 16:48:26.656 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: Scheduling ad refresh 70000 milliseconds from now. 07-12 16:48:26.666 31812-31812/com.greypixelapps.guide.clashofclans I/DynamiteModule: Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:290 07-12 16:48:26.666 31812-31812/com.greypixelapps.guide.clashofclans I/DynamiteModule: Selected remote version of com.google.android.gms.ads.dynamite, version >= 290 07-12 16:48:26.676 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: Ad finished loading. 07-12 16:48:26.676 31812-31812/com.greypixelapps.guide.clashofclans I/com.clockbyte.admobadapter.bannerads.AdmobFetcherBanner: onAdFetched 07-12 16:48:27.757 31812-31812/com.greypixelapps.guide.clashofclans W/Ads: Not enough space to show ad. Needs 320x50 dp, but only has 313x50 dp.

I think ad are not loading for not enough space. But In my layout I don't have any right or left margin

kot331107 commented 6 years ago

@Hasan-Mahmud Then you definitely have some paddings there... try to use the method setSingleAdSize(<put your AdSize from log, i.e. 313x50>)

Hasan-Mahmud commented 6 years ago

@kot331107 thanks for your Replay. But when i build admobadapter code it gives me same problem.

kot331107 commented 6 years ago

@Hasan-Mahmud image Strange, because I have ad banners displaying OK...Are you sure you use the sampleapp demo project without any specific changes from you side?

Hasan-Mahmud commented 6 years ago

@kot331107 I think so. <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/ad_card_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" app:cardCornerRadius="0dp" app:cardElevation="0dp">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <FrameLayout android:id="@+id/ad_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView android:id="@+id/text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Ad is loading..."
            android:textColor="@android:color/holo_red_dark"/>
    </FrameLayout>

    <FrameLayout
        android:id="@+id/margin_bottom"
        android:layout_width="match_parent"
        android:layout_height="8dp"
        android:background="@android:color/holo_red_dark"/>

</LinearLayout>

</android.support.v7.widget.CardView>

custom layout for implement own custom wrapping behaviour: it was given by default. and logcat is

07-15 17:29:44.140 9410-9410/com.clockbyte.admobadapter.sampleapp I/Ads: Use AdRequest.Builder.addTestDevice("D557F4B7EAE8CD020E0E79380D8E76DC") to get test ads on this device. 07-15 17:29:44.160 9410-9410/com.clockbyte.admobadapter.sampleapp W/Ads: Not retrying to fetch app settings 07-15 17:29:44.210 9387-10208/? W/Ads: App does not have the required permissions to get location 07-15 17:29:44.250 9387-10211/? W/Ads: App does not have the required permissions to get location 07-15 17:29:45.221 9410-9410/com.clockbyte.admobadapter.sampleapp W/Ads: Not enough space to show ad. Needs 320x50 dp, but only has 317x50 dp. 07-15 17:29:45.371 9410-9410/com.clockbyte.admobadapter.sampleapp W/Ads: Not enough space to show ad. Needs 320x50 dp, but only has 317x50 dp. 07-15 17:29:45.581 9410-9410/com.clockbyte.admobadapter.sampleapp W/Ads: Not enough space to show ad. Needs 320x50 dp, but only has 317x50 dp.

But when I run it another device it's work just like you shown.

kot331107 commented 6 years ago

@Hasan-Mahmud Sorry for my late reply! So please try to add test device ID which was shown in your LogCat:

07-12 16:48:23.172 31812-31812/com.greypixelapps.guide.clashofclans I/Ads: Use AdRequest.Builder.addTestDevice("D557F4B7EAE8CD020E0E79380D8E76DC") to get test ads on this device.

just add this ID "D557F4B7EAE8CD020E0E79380D8E76DC" to your deviceIds. When you'll be ready to release your app, pass the adMobUnitIdas the ad unit ID from your Admob console (not the test one). .setSingleAdUnitId(adMobUnitId)

kot331107 commented 5 years ago

@Hasan-Mahmud how its going?