HMS Ads Kit | Solar2D

Kayahan Başkeser
Huawei Developers
Published in
2 min readFeb 15, 2021

--

Hi everyone,

In this article, I will mention how to use HMS Ads Kit on Solar2D.

First of all, we should create a Solar2D project and import plugin to “build.settings ” file. If you do not have enough information about HMS Solar2D plugin integration, I recommend you to read below article. HMS Solar2D Plugin Integration

Let’s start after completing the HMS integration.

First we need to import plugin to “build.settings” file.

And we need to specify minSdkVersion in build.settings file for HMS Ads Kit.

Note : Don`t forget to place agconnect-services.json file in main.lua directory.

After all the configuration processes, you must define the plugin in main.lua.

We should call all methods through adsKit object. And you can take result information from listener function.

Ads Types

Banner Ad

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 regular intervals. When a user clicks a banner ad, the user is usually redirected to the advertiser’s page.

create

Banner ad is created and the necessary settings are made.

load

The created ad is sent to the request of the Huawei Ads Network and the ad is loaded.

show

After the ad has been successfully uploaded, Call this function to run to be displayed on the screen.

hide

Call this function to hide the advertisement.

Interstitial Ad

Interstitial ads are full-screen ads that cover the interface of an app. Such an ad is displayed when a user starts, pauses, or exits an app, without disrupting the user’s experience.

create

Use to create a ad and make the necessary settings.

load

Use to load created ad.

show

Use to show loaded ad.

Rewarded Ad

Rewarded ads are full-screen video ads that reward users for watching.

create

load

Use to load created ad.

show

Use to show loaded ad.

The HUAWEI Ads SDK allows you to set the request ad content for different audiences. Please check for detailed information about request options.

And you can examine the sample project from the following repository.

References

--

--