# hms-ads-demo-javascript **Repository Path**: hms-core/hms-ads-demo-javascript ## Basic Information - **Project Name**: hms-ads-demo-javascript - **Description**: 华为广告服务流量变现服务JavaScript版本示例代码,帮助开发者完成适用于App中Web页面的广告开发。支持原生广告、Banner广告、激励广告、插屏广告等能力 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: https://developer.huawei.com/consumer/cn/hms/huawei-adskit?ha_source=hms1 - **GVP Project**: No ## Statistics - **Stars**: 3 - **Forks**: 0 - **Created**: 2021-08-12 - **Last Updated**: 2023-06-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Petal Ads Demo for JavaScript English | [中文](README_ZH.md) ## Table of Contents * [Introduction](#introduction) * [Installation](#installation) * [Supported Environments](#supported-environments) * [Sample Code](#sample-code) * [Result](#result) * [License](#license) ## Introduction The hms-ads-demo-javascript program demonstrates how to integrate the Petal Ads JavaScript API into a H5 Page and display ads. ## Installation Install the program on Huawei Android mobile phones. ## Supported Environments HMS Core (APK) 6.0.0 or later has been installed on Huawei Android phones. ## Sample Code The hms-ads-demo-javascript program integrates the Petal Ads JavaScript API and provides the pages for displaying banner, native, rewarded, interstitial ads respectively. The following html in the demo are used for loading and displaying ads and collecting user comments: 1). banner.html Loads and displays banner ads.
Code location: app\src\main\assets\banner.html
2). native.html Loads and displays native ads.
Code location: app\src\main\assets\native.html
3). reward.html Loads and displays rewarded ads.
Code location: app\src\main\assets\reward.html
4). interstitial.html Loads and displays interstitial ads.
Code location: app\src\main\assets\interstitial.html
5). ConsentActivity.java Collects user consent.
Code location: app\src\main\java\com\huawei\hms\ads\jsdemo\ConsentActivity.java
6). ProtocolActivity.java Collects user consent on privacy terms.
Code location: app\src\main\java\com\huawei\hms\ads\jsdemo\ProtocolActivity.java
## Result Banner Ads         Interstitial Ads Reward Ads        Native Ads ## Question or issues If you want to evaluate more about HMS Core, [HMSCore on Reddit](https://www.reddit.com/r/HuaweiDevelopers/) is for you to keep up with latest news about HMS Core, and to exchange insights with other developers. If you have questions about how to use HMS samples, try the following options: - [Stack Overflow](https://stackoverflow.com/questions/tagged/huawei-mobile-services) is the best place for any programming questions. Be sure to tag your question with `huawei-mobile-services`. - [Huawei Developer Forum](https://forums.developer.huawei.com/forumPortal/en/home?fid=0101187876626530001) HMS Core Module is great for general questions, or seeking recommendations and opinions. If you run into a bug in our samples, please submit an [issue](https://github.com/HMS-Core/hms-ads-demo-javascript/issues) to the Repository. Even better you can submit a [Pull Request](https://github.com/HMS-Core/hms-ads-demo-javascript/pulls) with a fix. ## License hms-ads-demo-javascript is licensed under the [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).