-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e26e27c
commit 968ceea
Showing
1 changed file
with
139 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,139 @@ | ||
# huawei.ads.imaadapter | ||
<h1 align="center">Huawei-Ima Adapter Github Documentation</h3> | ||
|
||
![Latest Version](https://img.shields.io/badge/latestVersion-1.1.beta-yellow) ![Kotlin](https://img.shields.io/badge/language-java-blue) | ||
<br> | ||
![Supported Platforms](https://img.shields.io/badge/Supported_Platforms:-Native_Android_-orange) | ||
|
||
# Introduction | ||
|
||
In this documentation we explained how to use Huawei-Ima Adapter in native android. | ||
|
||
# How to start? | ||
|
||
## Create an ad unit on Huawei Publisher Service | ||
|
||
1. Sign in to [Huawei Developer Console](https://developer.huawei.com/consumer/en/console) and create an ad unit for Roll Ads. | ||
|
||
## What is IMA? | ||
|
||
Interactive Media Ads is a suite of SDKs that make it easy to integrate multimedia ads into your apps. IMA SDKs can request ads from any Vast-compliant ad server and manage ad playback in your apps. | ||
|
||
Developers need to create ad tags to show video ads in their application. These ad tags are unique URLs that generated by publishers from Ad Manager. | ||
|
||
## Create Ad Tag URL on Ad Manager | ||
|
||
1. Sign in to Google Ad Manager. | ||
2. Click Inventory and then Ad units. | ||
3. Locate and click your video ad unit. | ||
4. Click Generate tags. | ||
5. Complete the 3-step process and click Continue after each step (Tag type, Tag Options, and Tag Results) | ||
6. Click done. | ||
|
||
## Ad Tag URL parameters to use Adapter | ||
|
||
A VAST ad tag URL is used by a player to retrieve video ad. | ||
|
||
> See [parameters](https://support.google.com/admanager/answer/10678356?hl=en) | ||
### Mandatory | ||
|
||
[output](https://support.google.com/admanager/answer/10678356?hl=en#output): The XML output type. [VAST](https://www.iab.com/guidelines/vast/), [VMAP](https://www.iab.com/guidelines/vmap/). | ||
|
||
[max_ad_duration](https://support.google.com/admanager/answer/10678356?hl=en#min_ad_duration-max_ad_duration): The duration range that an ad must match. Default value (20) is used if this parameter is not set. | ||
|
||
[sz](https://support.google.com/admanager/answer/10678356?hl=en#sz): The size of master video ad slot. Default value (640x360) is used if this parameter is not set. | ||
|
||
### Optional | ||
|
||
[vpos](https://support.google.com/admanager/answer/10678356?hl=en#vpos): Indicates whether the ad request is being sent from pre-roll, mid-roll or post-roll. | ||
|
||
[vad_type](https://support.google.com/admanager/answer/10678356?hl=en#vad_type): Indicates whether a linear or non-linear ad should be returned. | ||
|
||
[npa](https://support.google.com/admanager/answer/10678356?hl=en#npa): Indicates that the ad request should be treated as non-personalized. | ||
|
||
[tfcd](https://support.google.com/admanager/answer/10678356?hl=en#tfcd): The ad request for child-directed treatment. | ||
|
||
## Integrate the Huawei Ima Adapter SDK | ||
|
||
In the **project-level** build.gradle, include Huawei's Maven repository. | ||
|
||
```groovy | ||
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 | ||
} | ||
} | ||
``` | ||
<h1 id="app-level"></h1> | ||
|
||
In the app-level build.gradle, include Huawei Ads dependency (required by the adapter) and the adapter | ||
|
||
```groovy | ||
dependencies { | ||
... | ||
'com.github.Explore-In-HMS:huawei.ads.imaadapter:<latest_version>' | ||
} | ||
``` | ||
|
||
# Version Change History | ||
|
||
## 1.1-beta | ||
|
||
## 1.0-beta | ||
|
||
# How it works? | ||
|
||
Solution has two different uses depending on ExoPlayer creation method or the selected player. | ||
|
||
If [ExoPlayer](https://exoplayer.dev) is used and it used with [MediaItem](https://exoplayer.dev/media-items.html) to show video content and ads, <b>adapter</b> solution can be choose. Initializations of adapter is as follows; | ||
|
||
```java | ||
|
||
HwImaAdapter.init(SimpleExoPlayer playerInstance, String adUnitId); | ||
|
||
``` | ||
|
||
or | ||
|
||
```java | ||
|
||
HwImaAdapter.init(PlayerView playerInstance,String HuaweiAdUnitId); | ||
|
||
``` | ||
|
||
> **_NOTE:_** <i>HwImaAdapter.init</i> method must be called just <b>before</b> <i>SimpleExoPlayer.prepare()</i> method called. | ||
<h1></h1> | ||
If [ExoPlayer](https://exoplayer.dev) is used and [MediaItem](https://exoplayer.dev/media-items.html) is not used or, player that compatible with Ima Ad Tag is used, <b>converter</b> solution can be choose. Initialization of converter is as follows; | ||
|
||
```java | ||
|
||
HwTagConverter.init(String googleImaAdTagURL, String HuaweiAdUInitId, TagConverterListener() { | ||
@Override | ||
public void onSuccess(Uri uri) { | ||
... | ||
// SimpleExoPlayer.prepare() | ||
... | ||
} | ||
}); | ||
|
||
``` | ||
If the operation is successful, the TagConverterListener's onSuccess function returns Uri instance that contains Huawei Roll Ads. Uri object is created based on the Ad Tag URL created on the Ad Manager. | ||
|
||
> **_NOTE:_** Video and ad content must be created <b>after</b> the callback is successful depends on the <i>Uri</i> instance. | ||
<h1></h1> | ||
|
||
Currently, adapter supports only linear ads depends on the [Huawei Vast SDK](https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/publisher-service-vast-0000001196327501). |