Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Admob banner slow down the app and doing too many work on main thread - Android

Tags:

android

admob

I have an activity that contain RecycleView with maximum 30 items. Every item contains 2 to 3 text views and 1 button. I have animation on clicking the button.

Before adding admob banner, the performance was really good, scrolling was smooth.

After adding admob banner, the scroll is cutting, clicking the button take a bit to respond. Aditionally, i see message shows me that Too many work on main thread!

Is there any suggestion about how to fix it ? Or what can help making it better ? How can I get smooth scrolling with admob banner enabled?

Hopefully I am not the only one facing this problem!

UPDATE:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v7.widget.RecyclerView
        android:paddingTop="30dp"
        android:paddingBottom="64dp"
        android:clipToPadding="false"
        android:id="@+id/rv_Test"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />


    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_gravity="center|bottom"
        ads:adSize="BANNER"
        ads:adUnitId="@string/banner_ad_unit_id" />

</RelativeLayout>
like image 232
MBH Avatar asked Dec 14 '15 22:12

MBH


1 Answers

It Seams that adView is the problem than I have replaced the adView with NativeContentAdView to use the Native Ads

Now the scroll is smooth

This is the link of the doc https://developers.google.com/admob/android/native

like image 154
Davide Avatar answered Nov 01 '22 07:11

Davide