Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AdActivity declared in AndroidManifest.xml with ConfigChanges for Admob

Tags:

android

admob

I am working on an Android app and trying to implement Admob advertisement sdk. I have done everything that have been mentioned in the documentation but I am getting following error in red color in the black window which should have displayed advertisement.

You must have AdActivity declared in AndroidManifest.xml with ConfigChanges

I have added following line in AndroidManifest.xml:

<activity
        android:name="com.google.ads.AdActivity"
        android:configChanges="keyboard|keyboardHidden|orientation" />

I have tried but still I am not able to resolve this error. I am trying to run the application in my Xperia phone which has Android 4.0.4.

like image 797
pankaj Avatar asked Dec 21 '22 13:12

pankaj


1 Answers

You need to put this in your manifest:

<activity android:name="com.google.android.gms.ads.AdActivity"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

AdViews handle a lot of configuration changes themselves. The official documentation can be found here.

According to unify, Admob is now integrated into Google Play Services. A migration reference can be found here.

like image 124
Techwolf Avatar answered Apr 13 '23 00:04

Techwolf