Home Game Development android – Using AdMob with Games that use Open GLES

android – Using AdMob with Games that use Open GLES

0
android – Using AdMob with Games that use Open GLES

[ad_1]

Can anybody assist me integrating Admob to my recreation. I’ve used the badlogic framework by MarioZencher … and My recreation is just like the SuperJumper. I’m unable to make use of AdMob after numerous my makes an attempt. I’m new to android dev…please assist me..I went via quite a lot of tutorials however not getting provides displayed …

I did the next…

  1. get the libraries and positioned them correctly
  2. My important.xml appears to be like like this

    android:layout_width=”fill_parent”
    android:layout_height=”wrap_content”
    android:textual content=”@string/howdy”
    />

  1. My Activity class onCreate methodology:

    public void onCreate(Bundle savedInstanceState) {
    tremendous.onCreate(savedInstanceState);

    RelativeLayout structure = new RelativeLayout(this);
    adView = new AdView(this, AdSize.BANNER, "a1518637fe542a2");
    AdRequest request = new AdRequest();
    request.addTestDevice(AdRequest.TEST_EMULATOR);
    request.addTestDevice("D77E32324019F80A2CECEAAAAAAAAA");    
    adView.loadAd(request);
          structure.addView(glView);
          RelativeLayout.LayoutParams adParams =
                  new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
                                  RelativeLayout.LayoutParams.WRAP_CONTENT);
          adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
          adParams.addRule(RelativeLayout.CENTER_IN_PARENT);
          structure.addView(adView, adParams);
          setContentView(structure);
    
    
    
    
    requestWindowCharacteristic(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowSupervisor.LayoutParams.FLAG_FULLSCREEN,
                         WindowSupervisor.LayoutParams.FLAG_FULLSCREEN);
    glView = new GLSurfaceView(this);
    glView.setRenderer(this);
    //setContentView(glView);
    
    glGraphics = new GLGraphics(glView);
    fileIO = new AndroidFileIO(getAssets());
    audio = new AndroidAudio(this);
    enter = new AndroidInput(this, glView, 1, 1);
    PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
    wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "GLGame");        
    

    }

  2. My Manifest file appears to be like like this ….

    <exercise android:title="com.google.adverts.AdvertActivity"
      android:configChanges="keyboard|keyboardHidden|orientation|smallestScreenSize"/>

</utility>
<uses-permission android:title="android.permission.WAKE_LOCK" />
<uses-permission android:title="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-sdk android:minSdkVersion="7" />

When I first determined to make use of the XML for admob function ..it confirmed no adjustments..it even did not log the machine id in Logcat…

Later after I wrote code within the Main Activity class.. and run …
Application crashed … with 7 errors evry time …

The android:configChanges worth of the com.google.adverts.AdvertActivity should embody screenLayout.

The android:configChanges worth of the com.google.adverts.AdvertActivity should embody uiMode.

The android:configChanges worth of the com.google.adverts.AdvertActivity should embody screenSize.

The android:configChanges worth of the com.google.adverts.AdvertActivity should embody smallestScreenSize.

You will need to have AdvertActivity declared in AndroidManifest.xml with configChanges.

You will need to have INTERNET and ACCESS_NETWORK_STATE permissions in AndroidManifest.xml.

Please assist me by telling what mistaken is there with the code?
Can I write code solely in xml information with out altering the Activity class …
I might be very grateful to anybody offering help.

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here