Issues with getting AdView to work when Activity is inside a library

1,300 views
Skip to first unread message

Akash dixit

unread,
Apr 2, 2018, 10:57:57 AM4/2/18
to Google Mobile Ads SDK Developers



So I have a project with Activity (Let's call it X) which loads an AdView and it all works just fine. Now I have another Activity (let's call it Y) which opens after certain actions, that Activity is inside a library project. Activity Y opens just fine and works well but the AdView I add to it never has anything in it, it is just just blank. Here are some odd messages I see on the logs:



04-02 15:34:53.948 20115-20115/com.omigo.app D/Ad: onCreate: Ad activity
04-02 15:34:53.978 20115-20115/com.omigo.app D/DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
04-02 15:34:54.018 20115-20115/com.omigo.app I/Ads: Updating ad debug logging enablement.
04-02 15:34:54.048 20115-20115/com.omigo.app I/Ads: Starting ad request.
04-02 15:34:54.058 20115-20115/com.omigo.app I/Ads: Use AdRequest.Builder.addTestDevice("A0B2481B7E47DF9CAC36B6AC708BD7E3") to get test ads on this device.
04-02 15:34:54.108 20115-21175/com.omigo.app D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=MainActivity, firebase_previous_id(_pi)=-1634885081742428969, firebase_screen_class(_sc)=Ad, firebase_screen_id(_si)=-1634885081742428968}]
04-02 15:34:54.178 20115-21175/com.omigo.app V/FA: Connection attempt already in progress
04-02 15:34:54.228 20115-21180/com.omigo.app W/Ads: Update ad debug logging enablement as false
04-02 15:34:54.308 20115-21175/com.omigo.app D/FA: Logging event (FE): ad_query(_aq), Bundle[{firebase_event_origin(_o)=am, firebase_screen_class(_sc)=Ad, firebase_screen_id(_si)=-1634885081742428968, ad_event_id(_aeid)=-1634885081742428967}]
04-02 15:35:03.908 20115-20115/com.omigo.app V/ActivityThread: updateVisibility : ActivityRecord{322f2c0 token=android.os.BinderProxy@80801bc {com.omigo.app/com.mdf.ambrowser.home.MainActivity}} show : true
04-02 15:35:55.248 20115-20115/com.omigo.app E/Ads: Timed out waiting for WebView to finish loading.








---
public class Ad extends AppCompatActivity {

private AdView mAdView;

private static final String TAG = "Ad";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ad);

Log.d(TAG, "onCreate: Ad activity");

MobileAds.initialize(this, "ca-app-pub-3940256099942544~3347511713");


mAdView = findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);


}
}



<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111">
</com.google.android.gms.ads.AdView>

mobileadssdk-a...@google.com

unread,
Apr 2, 2018, 3:43:31 PM4/2/18
to Akash dixit, Google Mobile Ads SDK Developers
Hi there,

Can you confirm what AdError is being thrown by the AdListener? It looks like the AdRequest is unable to proceed with the Activity and might be an implementation issue. Can you try to reproduce with our sample apps and let us know? Or give us steps to reproduce this issue?

Regards,
Deepika Uragayala
Mobile Ads SDK Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-admob-ads-sdk/5eb83113-a179-45a7-8fdb-b4ca454cd493%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Akash dixit

unread,
Apr 3, 2018, 11:50:30 AM4/3/18
to Google Mobile Ads SDK Developers
I used sample app code.. the strange thing is when i used that activity as launcher it show ads.. But same activity without any change dont show ads when it open after certain action/ activities
It show blank page.

mobileadssdk-a...@google.com

unread,
Apr 3, 2018, 3:07:41 PM4/3/18
to Akash dixit, Google Mobile Ads SDK Developers
Hi Akash, 

Can you provide us a sample project and send us the steps to reproduce to debug this on our end? Also, please share complete device logs.

Regards,
Deepika Uragayala
Mobile Ads SDK Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.

Akash dixit

unread,
Apr 3, 2018, 4:07:06 PM4/3/18
to Google Mobile Ads SDK Developers
Here is the logs of my app
 
04-04 01:08:32.437 23303-23303/ D/ViewRootImpl: ViewPostImeInputStage processPointer 0
04-04 01:08:32.567 23303-23303/ D/ViewRootImpl: ViewPostImeInputStage processPointer 1
04-04 01:08:33.887 23303-23303/ D/ViewRootImpl: ViewPostImeInputStage processPointer 0
04-04 01:08:33.997 23303-23303/ D/ViewRootImpl: ViewPostImeInputStage processPointer 1
04-04 01:08:34.347 23303-23303/ I/Timeline: Timeline: Activity_launch_request id: time:28158657
04-04 01:08:34.387 23303-23677/ V/FA: Recording user engagement, ms: 243060
04-04 01:08:34.387 23303-23677/ V/FA: Connecting to remote service
04-04 01:08:34.387 23303-23677/ V/FA: Activity paused, time: 43122785
04-04 01:08:34.387 23303-23677/ D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=243060, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=-9083480509803982646}]
04-04 01:08:34.407 23303-23677/ V/FA: Connection attempt already in progress
04-04 01:08:34.407 23303-23303/ V/FA: onActivityCreated
04-04 01:08:34.457 23303-23303/ D/TextView: setTypeface with style : 0
04-04 01:08:34.457 23303-23303/ D/Ad: onCreate: 
04-04 01:08:34.557 23303-23303/ W/System: ClassLoader referenced unknown path: /data/data/com.google.android.gms/app_chimera/m/0000001f/n/armeabi-v7a
04-04 01:08:34.557 23303-23303/ W/System: ClassLoader referenced unknown path: /data/data/com.google.android.gms/app_chimera/m/0000001f/n/armeabi
04-04 01:08:34.557 23303-23303/ D/ResourcesManager: For user 0 new overlays fetched Null
04-04 01:08:34.567 23303-23303/ D/DynamitePackage: Instantiated singleton DynamitePackage.
04-04 01:08:34.567 23303-23303/ D/DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraMobileAdsSettingManagerCreatorImpl
04-04 01:08:34.747 23303-23303/ D/DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
04-04 01:08:34.777 23303-23303/ I/Ads: Updating ad debug logging enablement.
04-04 01:08:34.817 23303-23303/ I/Ads: Starting ad request.
04-04 01:08:34.817 23303-23303/ I/Ads: Use AdRequest.Builder.addTestDevice("A0B2481B7E47DF9CAC36B6AC708BD7E3") to get test ads on this device.
04-04 01:08:34.827 23303-23303/ W/Ads: Not retrying to fetch app settings
04-04 01:08:34.847 23303-23303/ D/ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{a2a47b4 I.E...... R.....ID 0,0-0,0}
04-04 01:08:34.857 23303-23677/ V/FA: Activity resumed, time: 43123259
04-04 01:08:34.867 23303-23677/ D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=MainActivity, firebase_previous_id(_pi)=-9083480509803982646, firebase_screen_class(_sc)=Ad, firebase_screen_id(_si)=-9083480509803982645}]
04-04 01:08:34.917 23303-23677/ V/FA: Connection attempt already in progress
04-04 01:08:34.927 23303-23677/ D/FA: Logging event (FE): ad_query(_aq), Bundle[{firebase_event_origin(_o)=am, firebase_screen_class(_sc)=Ad, firebase_screen_id(_si)=-9083480509803982645, ad_event_id(_aeid)=-9083480509803982644}]
04-04 01:08:34.937 23303-23313/ I/art: Background partial concurrent mark sweep GC freed 224877(9MB) AllocSpace objects, 28(1880KB) LOS objects, 38% free, 25MB/41MB, paused 9.276ms total 151.764ms
04-04 01:08:34.967 23303-23689/ W/Ads: Update ad debug logging enablement as false
04-04 01:08:34.967 23303-23677/ V/FA: Connection attempt already in progress
04-04 01:08:34.967 23303-23677/ D/FA: Connected to remote service
04-04 01:08:34.967 23303-23677/ V/FA: Processing queued up service tasks: 5
04-04 01:08:34.977 23303-23303/ D/ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 48 - 0, 0) vi=Rect(0, 48 - 0, 0) or=1
04-04 01:08:35.087 23303-23303/ I/chromium: [INFO:CONSOLE(0)] "Document was loaded from Application Cache with manifest https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40-loader.appcache", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40-loader.html (0)
04-04 01:08:35.087 23303-23303/ I/chromium: [INFO:CONSOLE(0)] "Application Cache Checking event", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40-loader.html (0)
04-04 01:08:36.017 23303-23303/ I/chromium: [INFO:CONSOLE(0)] "Application Cache NoUpdate event", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40-loader.html (0)
04-04 01:08:40.127 23303-23677/ V/FA: Inactivity, disconnecting from the service
04-04 01:08:44.427 23303-23303/ V/ActivityThread: updateVisibility : ActivityRecord{966a02f token=android.os.BinderProxy@522ea76 {/com.mdf.ambrowser.home.MainActivity}} show : false
04-04 01:08:44.427 23303-23303/ I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@80c2c87 time:28168738
04-04 01:08:44.427 23303-23303/ I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@522ea76 time:28168739
04-04 01:09:36.717 23303-23303/ E/Ads: Timed out waiting for WebView to finish loading.
04-04 01:10:49.247 23303-23898/ V/FA: Recording user engagement, ms: 134396
04-04 01:10:49.247 23303-23898/ V/FA: Connecting to remote service
04-04 01:10:49.247 23303-23898/ V/FA: Activity paused, time: 43257652
04-04 01:10:49.257 23303-23898/ D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=134396, firebase_screen_class(_sc)=Ad, firebase_screen_id(_si)=-9083480509803982645}]
04-04 01:10:49.277 23303-23898/ V/FA: Connection attempt already in progress
04-04 01:10:49.277 23303-23898/ D/FA: Connected to remote service
04-04 01:10:49.277 23303-23898/ V/FA: Processing queued up service tasks: 2
04-04 01:10:51.317 23303-23303/ V/ActivityThread: updateVisibility : ActivityRecord{f600572 token=android.os.BinderProxy@80c2c87 {/com.mdf.ambrowser.home.download.Ad}} show : true
04-04 01:10:54.277 23303-23898/ V/FA: Activity resumed, time: 43262688
04-04 01:10:54.297 23303-23303/ I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@80c2c87 time:28298603
04-04 01:10:59.297 23303-23898/ V/FA: Inactivity, disconnecting from the service


-----

There is no problem in code impletation because when i make this activity as launcher in manifestfile it show ads


        <activity android:name=".home.download.Ad">

<intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

        </activity>


But when i remove intent filter and visit that activity after some action that activity not show ads

     <activity android:name=".home.download.Ad"></activity>
     


mobileadssdk-a...@google.com

unread,
Apr 4, 2018, 3:01:06 PM4/4/18
to Akash dixit, Google Mobile Ads SDK Developers
Hi Akash,

From what I understand, you are only able to load ads from the MainActivity? And not from any other Activity from within the app? We do have an advanced sample app that loads an ad from a Fragment and this might help you with the integration. If this still does not fix the issue, do send us a sample app and we will help you with the integration.


Regards,
Deepika Uragayala
Mobile Ads SDK Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+ page:
    http://googleadsdeveloper.blogspot.com
    https://plus.google.com/115658573333388777174/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--

---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages