Skip to content

Explore-In-HMS/huawei.ads.ironsource_mediation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Huawei-IronSource Mediation Github Documentation

Latest Version Kotlin
Supported Platforms Supported Platforms

Introduction

This is a project to demonstrate how to use IronSource’s mediation feature with Huawei Ads Kit.

Compatibility

Platform Banner Ad Interstitial Ad Rewarded Ad
Native (Java/Kotlin) âś… âś… âś…
Flutter (Dart) âś… âś… âś…

How to start?

Create an ad unit on Huawei Publisher Service

  1. Sign in to Huawei Developer Console and create an AdUnit

Create an app & Add Custom network on IronSource Platform:

Make sure to check the article on How to use Huawei Ads with IronSource mediation ?

  1. Sign in to your Platform Ironsource and add an App
  2. Go to SDK Networks, click Manage Networks and add Custom Adapter ( Important Note: Your account must be activated to be able to see Custom Adapter section)
  3. Enter the Network Key ( Network Key is : 15b993999)
  4. Enter the ClientID and SecretKey that obtained from Huawei Console
  5. Click the setup button and update requested parameters (AdUnitID, Rate, TagUnderAgeOfPromise, etc...)
  6. Add the adapter and its dependencies into your project
  7. Configuration is done

Important Note: To be able to do mediation, do not forget to disable test mode on IronSource platform.

Huawei Ads Custom Adapter

Network Key Network Name
15b993999 HuaweiAds

Parameters Description

Key Description Possible value
adUnitID Huawei Ads Unit ID String
appID Huawei Ads App ID String
tagForChildProtection Sets the tag for child-directed content, to comply with the Children's Online Privacy Protection Act (COPPA).
  • true: You want your ad content to be COPPA-compliant (interest-based ads and remarketing ads will be disabled for the ad request).
  • false: You do not want your ad content to be COPPA-compliant.
tagUnderAgeOfPromise Sets the tag for users in the European Economic Area (EEA) under the age of consent, to comply with the General Data Protection Regulation (GDPR). Ad requests with this tag enabled will be unable to obtain personalized ads.
  • true: You want the ad request to meet the ad standard for users under the age of consent.
  • false: You do not want the ad request to meet the ad standard for users under the age of consent.

Note: All values ​​must be String format.

Integrate the Huawei Mediation SDK

In the project-level build.gradle, include Huawei’s maven repository

repositories {
    google()
    jcenter() // Also, make sure jcenter() is included
    maven { url 'https://developer.huawei.com/repo/' } // Add this line
    maven {url "https://jitpack.io"} // Add this line
}

...

allprojects {
    repositories {
        google()
        jcenter() // Also, make sure jcenter() is included
        maven { url 'https://developer.huawei.com/repo/' } //Add this line
        maven {url "https://jitpack.io"} // Add this line
    }
}

In the app-level build.gradle, include Huawei Ads dependency (required by the adapter) and the Huawei mediation adapter

dependencies {
   //Huawei Ads Prime
   implementation 'com.huawei.hms:ads-prime:<latest_version>'
   //Adapter SDK
   implementation 'com.github.Explore-In-HMS:huawei.ads.ironsource_mediation:<latest_version>'
}

NOTE: If your app can run only on Huawei mobile phones, you can integrate the Huawei Ads Lite SDK instead of Huawei Ads SDK (Optional)

dependencies {
    //Huawei Ads Lite
    implementation 'com.huawei.hms:ads-lite:<latest_version>'
    ...
}

Latest version of SDKs

Permissions

The HUAWEI Ads SDK (com.huawei.hms:ads) has integrated the required permissions. Therefore, you do not need to apply for these permissions.

android.permission.ACCESS_NETWORK_STATE: Checks whether the current network is available.

android.permission.ACCESS_WIFI_STATE: Obtains the current Wi-Fi connection status and the information about WLAN hotspots.

android.permission.BLUETOOTH: Obtains the statuses of paired Bluetooth devices. (The permission can be removed if not necessary.)

android.permission.CAMERA: Displays AR ads in the Camera app. (The permission can be removed if not necessary.)

android.permission.READ_CALENDAR: Reads calendar events and their subscription statuses. (The permission can be removed if not necessary.)

android.permission.WRITE_CALENDAR: Creates a calendar event when a user clicks the subscription button in an ad. (The permission can be removed if not necessary.)

Version Change History

1.2.0

  • Banner Ad support added
  • Huawei Ads SDK version upgraded to latest version.
  • IronSource Android SDK version upgraded from 7.3.0 to 7.3.0.1.

1.1.3

  • Huawei Ads SDK version upgraded to latest version.
  • IronSource Android SDK version upgraded from 7.2.1 to 7.3.0.

1.1.1

  • Integration methods of Huawei Ads SDK in the plugin have been changed to compileOnly.
  • Huawei Ads SDK (lite or prime) has to be added externally to the app anymore.

1.1.0

Rewarded ad support added

1.0.4

Initial release

Platforms

Native

This section demonstrates how to use IronSource mediation feature with Huawei Ads Kit on Native android app.

Firstly, integrate the IronSource SDK for Android

IronSource Android SDK can be used for all ad types.

Note :

  1. Developers can find app level build.gradle in their project from "app-folder/app/build.gradle"
  2. If you use the native ad format in your application, please submit a ticket here to get support from Huawei.

Banner Ad

To use Banner ads in Native android apps, please check the IronSource SDK. Click here to get more information about IronSource SDKs Banner Ad development.

Interstitial Ad

To use Interstitial ads in Native android apps, please check the IronSource SDK. Click here to get more information about IronSource SDKs Interstitial Ad development.

Rewarded Ad

To use Rewarded ads in Native android apps, please check the IronSource SDK. Click here to get more information about IronSource SDKs Interstitial Ad development.

Sample Codes Based on Ad Types

Banner Ad

        // instantiate IronSourceBanner object, using the IronSource.createBanner API
        val banner = IronSource.createBanner(this, ISBannerSize(320, 50))
        // init the IronSource SDKAPP_KEY
        IronSource.init(this, APP_KEY, IronSource.AD_UNIT.BANNER);
        // load ad into the created banner
        IronSource.loadBanner(banner);
        // add IronSourceBanner to your container
        findViewById<FrameLayout>(R.id.frame).addView(banner)

Interstitial Ad

        // set the interstitial listener
        IronSource.setInterstitialListener(this)
        // add impression data listener
        IronSource.addImpressionDataListener(this)
        // init the IronSource SDKAPP_KEY
        IronSource.init(this, APP_KEY,IronSource.AD_UNIT.INTERSTITIAL)
        IronSource.loadInterstitial()
        
            if (IronSource.isInterstitialReady()) {
                //show the interstitial
                IronSource.showInterstitial()
            }
        

Rewarded Ad

        // set the IronSource rewarded video listener
        IronSource.setRewardedVideoListener(this)
        // add impression data listener
        IronSource.addImpressionDataListener(this)
         // init the IronSource SDK
        IronSource.init(this, APP_KEY)
        
        if (IronSource.isRewardedVideoAvailable()) //show rewarded video
              IronSource.showRewardedVideo()

Flutter

This section demonstrates how to use IronSource feature with Huawei Ads Kit on Flutter.

Make sure to check the article on How to use Huawei Ads with IronSource Mediation in Flutter?

Supported Ad Formats are: Banner Ads, Interstitial Ads and Rewarded Ads.

Firstly, integrate the IronSource Flutter Plugin to Flutter.

For more details on IronSource Flutter Plugin visit here

Banner Ads

To use Banner ads in Flutter , please check the IronSource Flutter Plugin. Click here to get more information about IronSource Flutter Banner Ad development.

Interstitial Ads

To use Interstitial ads in Flutter, please check the IronSource Flutter Plugin. Click here to get more information about IronSource Flutter Interstitial Ad development.

Rewarded Ads

To use Rewarded ads in Flutter, please check the IronSource Flutter Plugin. Click here to get more information about IronSource Flutter Banner Ad development.

Step 1:

Add the line ironsource_mediation: ^1.1.0 to the dependicies section of your pubspec.yalm file

Step 2:

Go to android file of your project and add necessary configurations in Integrate the Huawei Mediation SDK section

After these configurations is completed you can display Huawei Ads.

Screenshots

IronSource Ads

Banner Ad

Interstitial Ad

Rewarded Ad

Huawei Ads

Banner Ad

Interstitial Ad

Rewarded Ad