—> Frist Open Ad mob Account And Get Banner ID And Interstitial ID.
Implement Admob Ads On Your Android Applicatio Please Contact us.
For Open Ad mob Account Refer This Link.
After Getting All Information Start Eclipse And Create New Project.
For ad mob sdk import project from the J:\android-sdk-windows\extras\google\google_play_services\libproject
—> AndroidManifest.xml
<!-- admob required permissions integration --> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- End of admob permissions integration --> <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"/>
–> For Banner Ads Open Layout.xml File.
<RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/mainLayout" android:layout_alignParentTop="true"></RelativeLayout>
open MyActivity.java file…
import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdSize; import com.google.android.gms.ads.AdView; import com.google.android.gms.ads.InterstitialAd; @SuppressWarnings("deprecation") public class MyActivity extends Activity { InterstitialAd mInterstitial; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); -------------------------------------------For Banner Ads------------------------------------------------ AdView mAdView = new AdView(Act_Change_Main_Background.this); mAdView.setAdUnitId("ca-app-pub-7105659740979394/2826037666"); mAdView.setAdSize(AdSize.BANNER); RelativeLayout layout = (RelativeLayout) findViewById(R.id.mainLayout); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); layout.addView(mAdView, params); mAdView.loadAd(new AdRequest.Builder().build()); ----------------------------------------For Interstitial Ads--------------------------------------------------- mInterstitial = new InterstitialAd(this); mInterstitial.setAdUnitId("ca-app-pub-7105659740979394/1209703665"); mInterstitial.loadAd(new AdRequest.Builder().build()); if (mInterstitial.isLoaded()) { mInterstitial.show(); } } }
—> Run Your Code.
Implement Admob Ads On Your Android Applicatio Please Contact us.
Leave a Reply