5 Star 8 Fork 5

华为移动服务 / hms-ads-demo-java

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 4.04 KB
一键复制 编辑 原始数据 按行查看 历史
chenqiuwei 提交于 2022-12-15 14:16 . Update README.md

Petal Ads Sample Code (Java)

English | 中文

Contents

Introduction

The Java sample code provided by Ads Kit describes how to display ads by integrating the Petal Ads SDK into your Android app.

Installation

Install the sample code on a Huawei phone.
You can use HMS Toolkit to quickly run the sample code. HMS Toolkit supports one-stop kit integration, and provides functions such as free app debugging on remote real devices. To learn more about HMS Toolkit, please refer to the HMS Toolkit documentation.

Configuration Management

N/A

Environment Requirements

Your Huawei phone has HMS Core (APK) 4.0.0 or later installed.

Sample Code

The Java sample code provided by Ads Kit integrates the Petal Ads SDK, which offers a range of ad formats including banner, native, rewarded, interstitial, splash, and roll ads. The sample code contains the following files for you to load and display ads and obtain user consent:

(1) BannerActivity.java Used to load and display banner ads.
Storage path: app\src\main\java\com\huawei\hms\ads\sdk\BannerActivity.java

(2) NativeActivity.java Used to load and display native ads.
Storage path: app\src\main\java\com\huawei\hms\ads\sdk\NativeActivity.java

(3) RewardActivity.java Used to load and display rewarded ads.
Storage path: app\src\main\java\com\huawei\hms\ads\sdk\RewardActivity.java

(4) InterstitialActivity.java Used to load and display interstitial ads.
Storage path: app\src\main\java\com\huawei\hms\ads\sdk\InterstitialActivity.java

(5) SplashActivity.java Used to load and display splash ads.
Storage path: app\src\main\java\com\huawei\hms\ads\sdk\SplashActivity.java

(6) InstreamActivity.java Used to load and display roll ads.
Storage path: app\src\main\java\com\huawei\hms\ads\sdk\InstreamActivity.java

(7) ConsentActivity.java Used to obtain user consent.
Storage path: app\src\main\java\com\huawei\hms\ads\sdk\ConsentActivity.java

(8) ProtocolActivity.java Used to obtain users' consent on the privacy statement.
Storage path: app\src\main\java\com\huawei\hms\ads\sdk\ProtocolActivity.java

Running Result

Banner ads         Interstitial ads        Native ads

Reward ads         Roll ads        Splash ads

Technical Support

You can visit the Reddit community to obtain the latest information about HMS Core and communicate with other developers.

If you have any questions about the sample code, try the following:

  • Visit Stack Overflow, submit your questions, and tag them with huawei-mobile-services. Huawei experts will answer your questions.
  • Visit the HMS Core section in the HUAWEI Developer Forum and communicate with other developers.

If you encounter any issues when using the sample code, submit your issues or submit a pull request.

License

The sample code is licensed under Apache License 2.0.

Java
1
https://gitee.com/hms-core/hms-ads-demo-java.git
git@gitee.com:hms-core/hms-ads-demo-java.git
hms-core
hms-ads-demo-java
hms-ads-demo-java
master

搜索帮助