Ads

Banner & Interstitial

Implement 4 Ad network type ( admob, fan, unity, applovin ) You can switch ad network on the go from Firebase Remote Config

AdConfig.java

From this file you can change default ad network, unit id, interval interstitial, and disable or enable ad

AdConfig.java
public static boolean ad_enable = true;
public static boolean enable_gdpr = true;
public static AdNetworkType ad_network = AdNetworkType.UNITY;
public static int ad_inters_interval = 5;

public static String ad_admob_publisher_id = "pub-3239677920600357";
public static String ad_admob_banner_unit_id = "ca-app-pub-3940256099942544/6300978111";
public static String ad_admob_interstitial_unit_id = "ca-app-pub-3940256099942544/1033173712";

public static String ad_fan_banner_unit_id = "IMG_16_9_APP_INSTALL#YOUR_PLACEMENT_ID";
public static String ad_fan_interstitial_unit_id = "IMG_16_9_APP_INSTALL#YOUR_PLACEMENT_ID";

public static String ad_applovin_banner_unit_id = "1849649d520e613b";
public static String ad_applovin_interstitial_unit_id = "d990fd82bd2f007b";

public static String ad_unity_game_id = "4655483";
public static String ad_unity_banner_unit_id = "Banner_Android";
public static String ad_unity_interstitial_unit_id = "Interstitial_Android";

OPEN BIDDING FAN ( Facebook Audience Network )

  1. AdMob as a Bidding Mediation Partner for Audience Network : Official documentation https://developers.facebook.com/docs/audience-network/bidding/partner-mediation/admob AdMob documentation how to set up ( Follow step 1 & 2 ) https://developers.google.com/admob/android/mediation/facebook

  2. AppLovin as a Bidding Mediation Partner for Audience Network : Official documentation

    https://developers.facebook.com/docs/audience-network/bidding/partner-mediation/max AppLovin guidance on how to set up https://dash.applovin.com/documentation/mediation/android/mediation-setup/facebook

Remote Config - Change Ad on The Go (Optional)

After publish your app to market you can change ad network from Firebase Remote Config, so you no need update your app,

How to change config?

1. Go to your firebase console https://console.firebase.google.com/, select your project

3. Add Key Value , key is the lowercase name variable at advertise/AdConfig.java this is remote config form

4. This is AdConfig.java, orange line is key, blue line is value

Disable Locally

this flag not fetch with remote config, so when you disable from this value, your data will not replace by remote config

public class AdConfig {

    // flag for display ads
    public static final boolean ADS_ENABLE = true;
    public static final boolean ADS_MAIN_INTERSTITIAL = ADS_ENABLE && true;
    public static final boolean ADS_MAIN_BANNER = ADS_ENABLE && true;
    public static final boolean ADS_RECIPE_DETAILS_BANNER = ADS_ENABLE && true;
    
    . . .
}

​GDPR

What is GDPR ?

To comply GDPR regulation you must configure some data

1. Admob publisher ID.

Here how you can found your admob publisher id : https://support.google.com/admob/answer/2784578?hl=en

Then change publisher Id in AdConfig.java

String ad_admob_publisher_id = "pub-3239677920600357"

2. Privacy Policy Url.

To meet GDPR regulation you also must provide your own privacy and policy url, you can use generator like this : https://app-privacy-policy-generator.firebaseapp.com/ or you can use other tools, after generate you can upload into your hosting or anywhere so user can view it.

Then please change privacy_policy_url in res/value/string.xml

<string name="privacy_policy_url">
    http://dream-space.web.id/doc_..........
</string>

Last updated