daster
daster

Reputation: 63

add a AdActivity and telling me to add a AdActivity

I have the new 15 version android sdk and the new admob sdk. On the layout preview of xmls file the banner show google ads however when I put it on my phone. In the banner it tells me to "You must have AdActivity declared in the AndroidManifest.xml with configChanges"Which I think i declared.

here are my codes:

xmnls files

 <com.google.ads.AdView android:id="@+id/adView"                         
     android:layout_width="wrap_content"                         
     android:layout_height="wrap_content"                         
     ads:adUnitId="xxxxxxxxxxxc"                         
     ads:adSize="BANNER"                                              
     ads:loadAdOnCreate="true"/>

main Activity:

public class MainAct extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // Look up the AdView as a resource and load a request.    
    AdView adView = (AdView)this.findViewById(R.id.adView);    
    adView.loadAd(new AdRequest());  


}

}

manifest

    <activity android:name="com.google.ads.AdActivity" 
        android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|fontScale">

    </activity>



</application>

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

I have follow what is on http://code.google.com/mobile/ads/docs/android/fundamentals.html thank you

Upvotes: 0

Views: 921

Answers (2)

daster
daster

Reputation: 63

It was the android taget. I had on 8.when it need to been on 13

Upvotes: 1

PacQ
PacQ

Reputation: 334

Did you mybe try with XML if that works for you like so:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:id="@+id/bannerLayout">
  <com.google.ads.AdView android:id="@+id/adView"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         ads:adUnitId="xxxxxxxxxxxxxx"
                         ads:adSize="BANNER"
                         ads:loadAdOnCreate="true"/>
</LinearLayout>

Upvotes: 0

Related Questions