Tuesday, March 15, 2016

libgdx admob

********** from 1 to 3: http://www.norakomi.com/tutorial_admob_part2.php


  • 1. open "AndroidManifest.xml file


  • 2. add these 2 lines in <application> </application>
<activity    android:name="com.google.android.gms.ads.AdActivity"    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<meta-data android:name="com.google.android.gms.version"           android:value="@integer/google_play_services_version" />

  • 3. add these permissions in <manifest> </manifest>

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



********** from 4: http://www.norakomi.com/tutorial_admob_part2_banner_ads1.php
















  • 5. do as image (1) (2) (3), copy "Ad unit ID" ca-app-pub-6303782572770148/9933061316


  • 6. Open "AndroidLauncher" 



  • 7. Do something like this:

package com.zxcongducxz.zyugioh;

import android.os.Bundle;
import android.view.*;
import android.widget.RelativeLayout;

import com.badlogic.gdx.backends.android.*;
import com.google.android.gms.ads.*;


public class AndroidLauncher extends AndroidApplication {
   @Override   protected void onCreate (Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();


      AdView bannerAd = new AdView(this);
      bannerAd.setVisibility(View.VISIBLE);
      bannerAd.setBackgroundColor(0xff000000); // black      bannerAd.setAdUnitId("ca-app-pub-6303782572770148/9933061316");
      bannerAd.setAdSize(AdSize.BANNER);

      View gameView = initializeForView(new zYuGiOh(), config);
      RelativeLayout layout = new RelativeLayout(this);
      layout.addView(gameView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
      RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
      params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
      layout.addView(bannerAd, params);

      setContentView(layout);
   }
}








































Tuesday, March 8, 2016

logcat trick

view errors in Unity:
"D:\android-sdk\platform-tools\adb.exe" logcat -s Unity:V

view errors in Android:
"D:\android-sdk\platform-tools\adb.exe" logcat -s AndroidRuntime:E