How to remove Admob

Step1: Right Click on project and open “Properties”

Step2: Rremove “Google play service libary” from project.

Step3: Remove this line from “menifest.xml”

  <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" />

Step4: Delete “banner_adview.xml” from “layout”.

Step5: Remove this line from all xml file in which you are getting errors

<include
       android:id="@+id/ad"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/include1"
        layout="@layout/banner_adview" />  

Step6: Open every Activity Class and remove this line

import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.InterstitialAd;

public InterstitialAd interstitial;

//** Admob Code */
AdView adView = (AdView) this.findViewById(R.id.adView);
AdRequest request = new AdRequest.Builder().build();
adView.loadAd(request);
interstitial = new InterstitialAd(getBaseContext());
interstitial.setAdUnitId(getResources().getString(
R.string.interstitial_id));
interstitial.loadAd(request);

if it’s present


@Override
public void onBackPressed() {
if (interstitial.isLoaded()) {
interstitial.show();
}
super.onBackPressed();
}

Step7: Clean your project and run.

How to add admob

Related Posts

Leave a comment

Hey, so you decided to leave a comment! That's great. Just fill in the required fields and hit submit. Note that your comment will need to be reviewed before its published.