java - admob is not show in my SDL game -


i have wrote sdl game , ported andorid

and tried integrate admob failed

androidmanifest

<?xml version="1.0" encoding="utf-8"?> <!-- replace org.libsdl.app identifier of game below, e.g.  com.gamemaker.game  -->  <manifest xmlns:android="http://schemas.android.com/apk/res/android"   package="com.libsdl.zomibeshooter"   android:versioncode="1"   android:versionname="1.0"   android:installlocation="auto">   <!-- create java class extending sdlactivity , place in      directory under src matching package, e.g.         src/com/gamemaker/game/mygame.java       replace "sdlactivity" name of class (e.g. "mygame")      in xml below.       example java class can found in readme-android.txt   -->  <uses-permission android:name="android.permission.internet"/>   <uses-permission android:name="android.permission.access_network_state"/>   <application android:label="@string/app_name"              android:icon="@drawable/ic_launcher"              android:allowbackup="true"              android:theme="@android:style/theme.notitlebar.fullscreen"              android:hardwareaccelerated="true" >     <activity android:name="mygame"               android:label="@string/app_name"               android:configchanges="keyboardhidden|orientation"               android:screenorientation="landscape"               >         <intent-filter>             <action android:name="android.intent.action.main" />             <category android:name="android.intent.category.launcher" />         </intent-filter>     </activity>     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />     <activity       android:name="com.google.android.gms.ads.adactivity"       android:configchanges="keyboard|keyboardhidden|orientation|screenlayout|uimode|screensize|smallestscreensize"        android:theme="@android:style/theme.translucent" />  </application>    <!-- android 2.3.3 --> <uses-sdk android:minsdkversion="10" android:targetsdkversion="19" />  <!-- opengl es 2.0 --> <uses-feature android:glesversion="0x00020000" />   <!-- allow writing external storage --> <uses-permission android:name="android.permission.write_external_storage" />     </manifest>  

main.xml

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" >    <com.google.android.gms.ads.adview   android:id="@+id/adview"   android:layout_width="wrap_content"   android:layout_height="wrap_content"   ads:adsize="banner"   ads:adunitid="xxxxx" />     </linearlayout> 

my sdlactivity.java

// setup @override protected void oncreate(bundle savedinstancestate) {       log.v("sdl", "oncreate():" + msingleton);     super.oncreate(savedinstancestate);       setcontentview(r.layout.main);   // prepare interstitial ad  interstitial = new interstitialad(sdlactivity.this);  // insert ad unit id  interstitial.setadunitid("xxxxxxx");   //locate banner ad in activity_main.xml  adview adview = (adview) this.findviewbyid(r.id.adview);   // request ads  adrequest adrequest = new adrequest.builder()   // add test device show test ads  .addtestdevice(adrequest.device_id_emulator)  .addtestdevice("cc5f2c72df2b356bbf0da198")  .build();   // load ads banner ads  adview.loadad(adrequest);   // load ads interstitial ads  interstitial.loadad(adrequest);   // prepare interstitial ad listener  interstitial.setadlistener(new adlistener() {  public void onadloaded() {  // call displayinterstitial() function  displayinterstitial();  }  });       sdlactivity.initialize();     // can call stuff static callbacks     msingleton = this;      // set surface     msurface = new sdlsurface(getapplication());      if(build.version.sdk_int >= 12) {         mjoystickhandler = new sdljoystickhandler_api12();     }     else {         mjoystickhandler = new sdljoystickhandler();     }      mlayout = new absolutelayout(this);     mlayout.addview(msurface);      setcontentview(mlayout); #########// if comment can see ad game not show! }  public void displayinterstitial() {     // if ads loaded, show interstitial else show nothing.     if (interstitial.isloaded()) {     log.v("ad","displayed");     interstitial.show();     }     } 

if comment line can see ad not game ! :

setcontentview(mlayout);

so how can show ad starting game until exit ?


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -