# Ad Networks

For monetization purposes, we provide **4 Ad Networks** options with the switch ads method, you can choose the ad network you want to display in the application **AppConfig/Ads**, you can change the ad network anytime you want. The following is a list of ad networks that are supported in this application :

1. Admob
2. FAN
3. Google Ad Manager
4. Iron Source

You can switch ad network on the go from Firebase Remote Config ( Optional )

### AppConfig.java -> Ads <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.

<figure><img src="https://content.gitbook.com/content/Ucivp5bhmKiNpsPJOVzZ/blobs/jxzZh4FBdhhoyJ10B5sx/image.png" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**IMPORTANT** : All ad network id units are placed in **AppConfig.java** except **admob\_app\_id**, both ids must be integrated programmatically in android code inside **res/value/advertise.xml**
{% endhint %}

<div align="left"><figure><img src="https://content.gitbook.com/content/Ucivp5bhmKiNpsPJOVzZ/blobs/hpEdPCg9kGl62ADofW8g/image.png" alt=""><figcaption></figcaption></figure></div>

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

```java
public class AppConfig extends AppConfigExt implements Serializable {

    // enable firebase remote config
    public static boolean USE_REMOTE_CONFIG = true;

    /* config for General Application */
    public static class General implements Serializable {

    }


    /* One Signal Notification */
    public static class Notification {
        
    }

    /* config for Ad Network */
    public static class Ads implements Serializable {

        /* enable disable ads */
        public boolean ad_enable = true;

        /* MULTI Ad network selection,
         * Fill this array to enable ad backup flow, left this empty to use single ad_network above
         * app will try show sequentially from this array
         * example flow ADMOB > FAN > IRONSOURCE
         * OPTION : ADMOB, MANAGER, FAN, IRONSOURCE
         * */
        public AdNetworkType[] ad_networks = {
                AdNetworkType.ADMOB,
                AdNetworkType.IRONSOURCE,
                AdNetworkType.FAN,
        };

        public boolean ad_enable_gdpr = true;

        /* disable enable ads each page */
        // if you not use ads you can set this to false
        public boolean ad_enable_banner_home = true;
        public boolean ad_enable_inters_home = true;
        public boolean ad_enable_banner_post = true;
        public boolean ad_enable_banner_page = true;
        public boolean ad_splash_open_app = false;
        public boolean ad_global_open_app = false;

        /* show interstitial after several action, this value for action counter */
        public int ad_inters_interval = 5;

        /* ad unit for ADMOB */
        public String ad_admob_publisher_id = "pub-3940256099942544";
        public String ad_admob_banner_unit_id = "ca-app-pub-3940256099942544/6300978111";
        public String ad_admob_interstitial_unit_id = "ca-app-pub-3940256099942544/1033173712";
        public String ad_admob_rewarded_unit_id = "ca-app-pub-3940256099942544/5224354917";
        public String ad_admob_open_app_unit_id = "ca-app-pub-3940256099942544/9257395921";

        /* ad unit for Google Ad Manager */
        public String ad_manager_banner_unit_id = "/6499/example/banner";
        public String ad_manager_interstitial_unit_id = "/6499/example/interstitial";
        public String ad_manager_rewarded_unit_id = "/6499/example/rewarded";
        public String ad_manager_open_app_unit_id = "/6499/example/app-open";

        /* ad unit for FAN */
        public String ad_fan_banner_unit_id = "YOUR_PLACEMENT_ID";
        public String ad_fan_interstitial_unit_id = "YOUR_PLACEMENT_ID";
        public String ad_fan_rewarded_unit_id = "YOUR_PLACEMENT_ID";

        /* ad unit for IRON SOURCE */
        public String ad_ironsource_app_key = "170112cfd";
        public String ad_ironsource_banner_unit_id = "DefaultBanner";
        public String ad_ironsource_rewarded_unit_id = "DefaultRewardedVideo";
        public String ad_ironsource_interstitial_unit_id = "DefaultInterstitial";
    }

}
```

{% endcode %}
