HMS Ads Kits
Hi everyone , Today I try describing how we can use HMS ads kit and Which type Ad kits we can use in our project. also I prepare an example of ad kit . You can see that at the end of page.
What is the Ads Kit ?
Ads kit are used to obtain revenues. HUAWEI Ads Publisher Service utilizes Huawei’s vast user base and extensive data capabilities to deliver targeted, high quality ad content to users.
Currently , HMS contains 7 kind of ads kits. If you want to learn detail information all ad kits , you can click link that is at end of ad definition
- Native Ads : Native ads are typical ad materials that are displayed on the customized interface of an app so that they can fit seamlessly into the surrounding content in the app. for Detail
- Banner Ads : Banner ads are rectangular images that occupy a spot at the top, middle, or bottom within an app’s layout. Banner ads refresh automatically at intervals. When a user taps a banner ad, the user is redirected to the advertiser’s page in most cases. for Detail
- Rewarded Ads : Rewarded ads are full-screen video ads that users opt to view in exchange for in-app rewards. for Detail
- Interstitial ads : Interstitial ads are full-screen ads that cover the interface of an app. Such ads are displayed when a user starts, pauses, or exits an app, without disrupting the user’s experience. for Detail
- Splash ads : Splash ads are displayed immediately after an app is launched, even before the home screen of the app is displayed. for Detail
- Express Splash ads : The express splash ads service is a new traffic monetization solution provided by HUAWEI Ads to improve splash ad experience without requiring you to integrate any SDK. for Detail
- Roll Ads : It is used to show short videos or images, before, during, or after the video content is played. for Detail
Note : More type of Ads will be published in the future …
Supported Device
What do we need to integrate Ad kit in our App ?
1.The HUAWEI Ads SDK requires the following permissions:
- android.permission.ACCESS_NETWORK_STATE: Checks whether the current network is available.
- android.permission.INTERNET
- android.permission.ACCESS_WIFI_STATE: Obtains the current Wi-Fi connection status and the information about WLAN hotspots.
2.Identifier Service
HUAWEI Ads Kit provides the open advertising identifier (OAID) and app install referrer capabilities for advertisers to deliver personalized ads and attribute conversions.
- OAID (Open Advertising Identifier) : An OAID is a non-permanent device identifier. You can use the OAID to provide personalized ads for users while protecting their privacy. In addition, you can cooperate with third-party tracking platforms to use OAIDs for conversion attribution.
Note : If a user resets the OAID, a new OAID is generated. Then, you can only obtain this new OAID. - App Install Referrer : You can obtain app install referrers through APIs provided by Huawei and use them to attribute conversions to different promotion channels.
to take Detail information about these two topics and learn how to integrate in your app please visit web site Link
Supported Country
3.You must add dependency in your app
4.What is Ad slot id ?
User integrate ads kit to take revenues. In this example I use test ad slot id Before releasing your app, apply for a formal ad slot ID and replace the test ad slot ID with the formal one.
please visit page for details Link
Demo Example
You can find how can implement ads kit in your app and learn all operations . But My example doesn’t provide taking OAID . I use test OAID for demo project.
Before start to integrate , I want to describe demo Project . It is a basic game that you can find number in .Firstly you watch a Splash Ad automatically before start playing game .If you don’t find number , you will watch a advertisement and take a bonus chance after that you can try one more time. While You are playing this game you will see a banner Ads bottom of screen .
Step 1 : Integrating the App Gallery Connect SDK
How can we integrate the App Gallery SDK, you can follow this Page: App Gallery Connect SDK
Also you can look at this example Page : Integrate Example
Note: App Gallery Connect SDK must be integrated to use HMS kits and service.
Step 2 : Integrating Dependency in app
Note : These two steps are general and We have to follow these .
Step 3 : Before starting development , We can prepare our application layouts. This demo contains two activity first activity is to show splash Ads and other one is main activity. Application starts on Splash activity.
Splash Activity Layout
Main Activity Layout
Step 4 : After design operation , We can start development. first of all I will describe banner ads next Reward ads and finally I will present Splash ads.
Note : If you want to use Huawei Ads kit in your app we have to add Huawei.init(Context context) method.
- Integrating Banner Ads
We add Banner View and determine requiring settings for example banner size , ad slot id that is mandatory, etc.
There are a few Banner size supported by HMS .
Under this line you can see relating information to integrate banner ads.
Note : We have to call HwAds.init(Context context) before calling setBannerAd().
- Integrating Rewarded Ad
You can use rewarded ads to show video ,gif or something like these to your users.
Step 1 ,Step 2 and Step 4 are general for all ads implementations for this reason I don’t mention these steps .
Note : We have to call HwAds.init(Context context) before calling setBannerAd().
We create an object to refer Reward Ad that takes two parameters context and ad slot id . also in example I use Test adId. after that we need to a listener that is called RewardAdLoadListener .after that We load it .
Call the isLoad() method to confirm that a rewarded ad has been loaded, and call the show() method of the Rewarded object to display the ad.
- Integrating Splash Ad
Splash ads are displayed after finishing an app or before starting app or like that. IN this example I use it before starting app.
We can use splash to show image and video. It supports Both types. We can modify showing duration or Unless you want to watch video or image ,You can skip and continues your operations. This kit includes many setting.
Supporting types
Note : If you want to change type of splash View you just change slot id
Step 1 ,Step 2 and Step 4 are general for all ads implementations for this reason I don’t mention these steps .
Note : We have to call HwAds.init(Context context) before calling setBannerAd().
HMS Ads kit provides us Splash View. When we want to use splash We will have to add this View.
Loading Splash Ad
We need to load Splash View and set same required settings.
As you know We need a Display listener .I don’t want to define all method so I will share links at end of article If you want to learn detail information following them.
Also We need override LoadListener
Splash ad take a few seconds to shows image or Video, After this operations our screen (Activity or Fragment) must be changed to another view .
If you want to look at full example you can download and investigate
Links
General Information of Ads Kit : Link
Identifier’s Information : Link
You can look at all example all examples : Link
You can download example from Github: