Ads

Google Admob - Banner & Interstitial

Since version 2.0 we move admob config into static value at res/values/strings.xml, this is because new rule from admob library

here how to get ad app id and unit id https://support.google.com/admob/answer/7356431?hl=en

res/values/strings.xml

<string name="admob_app_id">ca-app-pub-XX</string>
<string name="banner_ad_unit_id">ca-app-pub-XX</string>
<string name="interstitial_ad_unit_id">ca-app-pub-XX</string>

Disable

new we make easy way to disable or enable adsense in the app, you only need to set boolean value with TRUE or FALSE

public class AppConfig {

    // flag for enable/disable all ads
	public static final boolean ADS_ENABLE = true;
	
    // flag for display ads (change true & false only )
	. . .
	public static final boolean ADS_MAIN_PAGE = AppConfig.ADS_ENABLE && true;
	public static final boolean ADS_PLAYLIST_DETAIL_PAGE = AppConfig.ADS_ENABLE && true;
	public static final boolean ADS_SEARCH_PAGE = AppConfig.ADS_ENABLE && true;
	
	. . .
}

Last updated