# Ads

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

### AdConfig.java <a href="#config-adsense" id="config-adsense"></a>

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

{% code title="AdConfig.java" %}

```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";
```

{% endcode %}

### 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><br>
2. **AppLovin** as a Bidding Mediation Partner for Audience Network :\
   Official documentation&#x20;

   <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) <a href="#disable" id="disable"></a>

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

{% embed url="<https://www.youtube.com/watch?v=_CXXVFPO6f0>" %}
Here explanation about Firebase Remote Config
{% endembed %}

How to change config?

1\. Go to your firebase console <https://console.firebase.google.com/>, select your project&#x20;

2\. Go to menu Remote Config

<div align="left"><img src="https://782879718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlisFzLLpBNEIwqbnAqab%2Fuploads%2FFhzQ5wTBIG4tcGXe38fa%2Fimage.png?alt=media&#x26;token=4dff3a60-d68d-45f2-a2ba-a5a2cdad7df2" alt=""></div>

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

![](https://782879718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlisFzLLpBNEIwqbnAqab%2Fuploads%2FADNiYRDcaBZs6K4TV3c6%2Fimage.png?alt=media\&token=7ed3c370-ba38-48b9-99d4-6d1836accb88)

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

![](https://782879718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlisFzLLpBNEIwqbnAqab%2Fuploads%2FVctojqpAjjNJ41RunzTo%2Fimage.png?alt=media\&token=089c9351-a19e-4741-897e-f402a75323e0)

### Disable Locally <a href="#disable" id="disable"></a>

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

```java
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 ?**](https://www.eugdpr.org/)​

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**

```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>
```
