Admob implementation
in
Android Processing
•
1 year ago
Welcome guys.
I wanted to implement Admob into my game. But when i start this game i get this error:
i'm using Admin SDK 6.0
My AndroidManifest.xml contain this:
and the main .pde contain this block and the end:
I wanted to implement Admob into my game. But when i start this game i get this error:
i'm using Admin SDK 6.0
My AndroidManifest.xml contain this:
- <?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="5" android:versionName="1.0.4" package="com.mayobirne.ssng.racerlite">
<uses-sdk android:minSdkVersion="8"/>
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"/>
<application android:debuggable="true" android:icon="@drawable/icon" android:label="SSNG Racer Lite">
<activity android:name="SSNG Racer Lite" >
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name="com.google.ads.AdActivity" android:screenOrientation="landscape" android:configChanges="keyboard|keyboardHidden|orientation">
</activity>
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
and the main .pde contain this block and the end:
- @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Window window = getWindow();
RelativeLayout adsLayout = new RelativeLayout(this);
RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.FILL_PARENT);
// Displays Ads at the bottom of your sketch, use Gravity.TOP to display them at the top
adsLayout.setGravity(Gravity.BOTTOM);
AdView adView = new AdView(this, AdSize.BANNER, "a14******"); // add your app-id
adsLayout.addView(adView);
AdRequest newAdReq = new AdRequest();
// Remark: uncomment next line for testing your Ads (fake ads)
newAdReq.setTesting(true);
adView.loadAd(newAdReq);
window.addContentView(adsLayout,lp2);
}
How to make it work? Thank you for your help ;).
1