NEW ADMOB INTEGRATIONS
Sign up as an Admob Publisher here. Log in to your dashboard once you have your account approved.
Identify your publisher ID on the top right of your dashboard.
create an ad unit for your application.
Download the new Google Play Services Library using the Android SDK Manager in your Eclipse IDE.
Import Google Play Services Library into your Eclipse IDE. I’ve found mine in D:\Eclipse\sdk\extras\google\google_play_services\libproject .
BANNER EXAMPLE
Create a new project in Eclipse
NewAdmobTutorial
Package Name : com.androidbegin.newadmobtutorial
Open your MainActivity.java and paste the following code.
Sign up as an Admob Publisher here. Log in to your dashboard once you have your account approved.
Identify your publisher ID on the top right of your dashboard.
create an ad unit for your application.
Download the new Google Play Services Library using the Android SDK Manager in your Eclipse IDE.
Import Google Play Services Library into your Eclipse IDE. I’ve found mine in D:\Eclipse\sdk\extras\google\google_play_services\libproject .
BANNER EXAMPLE
Create a new project in Eclipse
NewAdmobTutorial
Package Name : com.androidbegin.newadmobtutorial
Open your MainActivity.java and paste the following code.
package com.androidbegin.newadmobtutorial;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.InterstitialAd;
import android.os.Bundle;
import android.app.Activity;
public class MainActivity extends Activity {
private InterstitialAd interstitial;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get the view from activity_main.xml
setContentView(R.layout.activity_main);
// Prepare the Interstitial Ad
interstitial = new InterstitialAd(MainActivity.this);
// Insert the Ad Unit ID
interstitial.setAdUnitId("ca-app-pub-123456789/123456789");
//Locate the Banner Ad in activity_main.xml
AdView adView = (AdView) this.findViewById(R.id.adView);
// Request for Ads
AdRequest adRequest = new AdRequest.Builder()
// Add a test device to show Test Ads
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("CC5F2C72DF2B356BBF0DA198")
.build();
// Load ads into Banner Ads
adView.loadAd(adRequest);
// Load ads into Interstitial Ads
interstitial.loadAd(adRequest);
// Prepare an Interstitial Ad Listener
interstitial.setAdListener(new AdListener() {
public void onAdLoaded() {
// Call displayInterstitial() function
displayInterstitial();
}
});
}
public void displayInterstitial() {
// If Ads are loaded, show Interstitial else show nothing.
if (interstitial.isLoaded()) {
interstitial.show();
}
}
}
In this MainActivity.java, a test device is being
used to run test ads. Its highly recommended to test your ads using test
ads to prevent invalid clicks that will cause suspension of your AdMob
publisher account. To generate a Test Device ID, simply type in some
random text into addTestDevice as shown below.
|
hai apakah kmu bisa menyediakan link download nya?
ReplyDeletesend in my email : coupethunter@yahoo.co.id
I can't understand what are you saying
Delete