GithubHelp home page GithubHelp logo

almaren / android_adnetworks_prioritiesmanager_with_remotecontrol Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 147 KB

Prioritize and control all ad networks at one place (including mediation SDKs) ! Control remotely via a Firebase remote config. Ad types: interstitials, rewarded. Ad networks: UnityAds (mediated or standalone), UnityMediation, IronSource,... Add other ad networks implementations.

License: Apache License 2.0

Kotlin 100.00%
android-ads unityads ironsource-ads admanager androidad android-library android-lib firebase-remote-config admob admob-ads

android_adnetworks_prioritiesmanager_with_remotecontrol's Introduction

Android_AdNetworks_PrioritiesManager_with_RemoteControl

  • How to control a multiple standalone ad networks in one place?
  • Maybe you need to use multiple mediation SDKs? How to set network priority?
  • You can mix mediated SDKs with standalone SDKs or with another mediated SDKs.
  • Enable/disable ad network remotely. Configure display priorities.
  • Target countries for each ad network.
  • Have you been looking for a well documented sample of UnityAds & UnityMediation for Android native?
  • My library not a mediation. Without control of mediated ads price.

Implemented ad types: interstitials, rewarded. Ad networks: Admob, UnityAds (mediated or standalone), Admob Mediation, Unity Mediation, SuperAwesome, Kidoz, IronSource. Written in Kotlin. No UI sample. Android library.

My library will organize your common use cases for each ad network implementation that you will add.

Use cases:

  1. Handle which ad network to enable/disable via a Firebase remote config.
  2. Define countries for each ad network. Currently separating LATAM region only.
  3. Define min/max Android version for each ad network.
  4. Processing data privacy: GDPR, CCPA, LGPD, ...
  5. Processing some user & device data for better targeting: app language, country, age, gender, phone/tablet..

Preparing:

  • Add to your project build.gradle:
    allprojects {
      repositories {
        ...
        maven { url 'https://jitpack.io' }
      }
    }
    
    to the app build.gradle:
    dependencies {
          implementation 'com.github.Almaren:Android_AdNetworks_PrioritiesManager_with_RemoteControl:1.0.2'
    }
    
  • Add to your /android/../AndroidManifest.xml in your where the ads will be used:
    <activity
       ...
       android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|mcc|mnc"
    />
    
    The necessary activities and overrides of ad networks are stored in my lib/AndroidManifest.xml. For better targeting some networks use coarse location, check if it required for you and complies with a Google policies, if so uncomment that line in the manifest.

How to use:

All methods of AdManager must be called from the main ui thread.

  1. Set app ID for each network in AdManager: APP_ID_YOUR_NET_AD. Set ad unit id for each network where marked "todo set your id". Check local.properties.
  2. Implement interface lib.ads.event.AdUserDeviceDataBinder, in my case implemented by MainActivity.
  3. First init: call AdManager.initAds() in your Activity.create(..). In my case calling it after age gate and consent dialog. At the second app launching I call it in a main page with already stored age and consent state.
  4. Implement your own logic in AdManager.getConsentUserData(). Implement age gate and consent dialog. Detect if user consent given for GDPR/CCPA/LGPD/PIPL.
  5. Enable/Disable test mode flags (marked as todo) in AdManager.createAdSources().
  6. Whenever your got a user ads data & consent state -> call AdManager.setPrivacyMetaData() to update ad networks with a privacy/consent data.
  7. Define default ad sources and their priority in AdSourcePriorityHandler.init(). Define adSourceForLatam, or comment the content of method updatePrioritiesRegardingToUserRegion() if it's not relevant to you.
  8. To load and display ad unit type just call a suitable methods from the AdManager. Call dispose() on YourActivity.onDestroy().
  9. Not mandatory: implement performing actions on each ad state in AdUnitBaseHandler.

Establishing Firebase remote config. (not mandatory) You can use the lib without firebase remote. If your firebase project is configured skip to step #4.

  1. Create project in Firebase if not exist yet.

  2. Configure a project in Firebase Settings -> SDK setup and configuration.
    add release and debug SHA keys.

  3. Download google-services.json from a project settings and place to /YourProject/android folder.

  4. Navigate in Firebase project to Remote config. Add parameter "adSourcesPriority" with the following value:

    {"IronSrc":[-1,-1], "AdmobMediation":[3,3], "UnityAdsMediation":[2,2],"UnityAds":[1,-1]}
    

    where array values indicates: [interstitial, rewarded], -1 = disabled, 1+ - priorities, the highest is more prioritized to display first.

  5. Fetch once the remote config from the server whenever required by creating RemoteConfigCoordinator object, passing AdManager and just calling RemoteConfigCoordinator.fetchAllData().


NOTICE: © On modifying and expanding lib be sure to attribute the link in your code headers: https://github.com/Almaren Thank You!

android_adnetworks_prioritiesmanager_with_remotecontrol's People

Contributors

almaren avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.