{"id":18905419,"url":"https://github.com/HMS-Core/hms-ads-demo-java","last_synced_at":"2025-04-15T04:31:17.546Z","repository":{"id":46779783,"uuid":"264616539","full_name":"HMS-Core/hms-ads-demo-java","owner":"HMS-Core","description":"HUAWEI Ads SDK sample code. HUAWEI Ads SDK provides the banner, native, rewarded, interstitial and splash ad formats for integration.","archived":false,"fork":false,"pushed_at":"2024-07-22T08:53:55.000Z","size":61683,"stargazers_count":57,"open_issues_count":13,"forks_count":20,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-03-29T04:11:18.519Z","etag":null,"topics":["ads","ads-kit","ads-sdk","hms","hms-ads","hms-ads-demo"],"latest_commit_sha":null,"homepage":"https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/ads-sdk-introduction?ha_source=hms1","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HMS-Core.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-17T08:30:11.000Z","updated_at":"2024-07-22T08:53:59.000Z","dependencies_parsed_at":"2024-11-08T09:12:13.333Z","dependency_job_id":"bf1fceaa-2e52-4d69-bad8-b7867178091c","html_url":"https://github.com/HMS-Core/hms-ads-demo-java","commit_stats":null,"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HMS-Core%2Fhms-ads-demo-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HMS-Core%2Fhms-ads-demo-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HMS-Core%2Fhms-ads-demo-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HMS-Core%2Fhms-ads-demo-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HMS-Core","download_url":"https://codeload.github.com/HMS-Core/hms-ads-demo-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249006389,"owners_count":21197263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ads","ads-kit","ads-sdk","hms","hms-ads","hms-ads-demo"],"created_at":"2024-11-08T09:11:54.905Z","updated_at":"2025-04-15T04:31:12.532Z","avatar_url":"https://github.com/HMS-Core.png","language":"Java","funding_links":[],"categories":["Community Projects"],"sub_categories":[],"readme":"﻿# Petal Ads Sample Code (Java)\nEnglish | [中文](https://github.com/HMS-Core/hms-ads-demo-java/blob/master/README_ZH.md)\n## Contents\n\n * [Introduction](#Introduction)\n * [Installation](#Installation)\n * [Configuration](#Configuration)\n * [Environment Requirements](#Environment-Requirements)\n * [Sample Code](#Sample-Code)\n * [Running Result](#Running-Result)\n * [License](#License)\n\n\n## Introduction\nThe Java sample code provided by Ads Kit describes how to display ads by integrating the Petal Ads SDK into your Android app.\n\n## Installation\nInstall the sample code on a Huawei phone.\n\u003cbr\u003eYou 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. \nTo learn more about HMS Toolkit, please refer to the [HMS Toolkit documentation](https://developer.huawei.com/consumer/en/doc/development/Tools-Guides/getting-started-0000001077381096?ha_source=hms1).\u003c/br\u003e\n\n## Configuration Management\nN/A\n\n## Environment Requirements\nYour Huawei phone has HMS Core (APK) 4.0.0 or later installed.\n\n## Sample Code\nThe 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:\n\n(1) BannerActivity.java\nUsed to load and display banner ads.\n\u003cbr\u003eStorage path: app\\src\\main\\java\\com\\huawei\\hms\\ads\\sdk\\BannerActivity.java\u003c/br\u003e\n    \n(2) NativeActivity.java\nUsed to load and display native ads.\n\u003cbr\u003eStorage path: app\\src\\main\\java\\com\\huawei\\hms\\ads\\sdk\\NativeActivity.java\u003c/br\u003e\n    \n(3) RewardActivity.java\nUsed to load and display rewarded ads.\n\u003cbr\u003eStorage path: app\\src\\main\\java\\com\\huawei\\hms\\ads\\sdk\\RewardActivity.java\u003c/br\u003e\n\t\n(4) InterstitialActivity.java\nUsed to load and display interstitial ads.\n\u003cbr\u003eStorage path: app\\src\\main\\java\\com\\huawei\\hms\\ads\\sdk\\InterstitialActivity.java\u003c/br\u003e\n\t\n(5) SplashActivity.java\nUsed to load and display splash ads.\n\u003cbr\u003eStorage path: app\\src\\main\\java\\com\\huawei\\hms\\ads\\sdk\\SplashActivity.java\u003c/br\u003e\n\t\n(6) InstreamActivity.java\nUsed to load and display roll ads.\n\u003cbr\u003eStorage path: app\\src\\main\\java\\com\\huawei\\hms\\ads\\sdk\\InstreamActivity.java\u003c/br\u003e\n    \n(7) ConsentActivity.java\nUsed to obtain user consent.\n\u003cbr\u003eStorage path: app\\src\\main\\java\\com\\huawei\\hms\\ads\\sdk\\ConsentActivity.java\u003c/br\u003e\n\n(8) ProtocolActivity.java\nUsed to obtain users' consent on the privacy statement.\n\u003cbr\u003eStorage path: app\\src\\main\\java\\com\\huawei\\hms\\ads\\sdk\\ProtocolActivity.java\u003c/br\u003e\n\n## Running Result\nBanner ads\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026ensp; Interstitial ads\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026ensp; Native ads\n\n \u003cimg src=\"/result/Banner.gif\" width=200\u003e  \u003cimg src=\"result/Interstitial.gif\" width=200\u003e  \u003cimg src=\"result/Native.gif\" width=200\u003e\n\nReward ads\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026ensp; Roll ads\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026emsp;\u0026ensp; Splash ads\n\n\u003cimg src=\"result/Reward.gif\" width=200\u003e  \u003cimg src=\"result/Roll.gif\" width=200\u003e  \u003cimg src=\"result/Splash.gif\" width=200\u003e\n\n## Technical Support\nYou can visit the [Reddit community](https://www.reddit.com/r/HuaweiDevelopers/) to obtain the latest information about HMS Core and communicate with other developers.\n\nIf you have any questions about the sample code, try the following:\n- Visit [Stack Overflow](https://stackoverflow.com/questions/tagged/huawei-mobile-services?tab=Votes), submit your questions, and tag them with `huawei-mobile-services`. Huawei experts will answer your questions.\n- Visit the HMS Core section in the [HUAWEI Developer Forum](https://forums.developer.huawei.com/forumPortal/en/home?fid=0101187876626530001?ha_source=hms1) and communicate with other developers.\n\nIf you encounter any issues when using the sample code, submit your [issues](https://github.com/HMS-Core/hms-ads-demo-java/issues) or submit a [pull request](https://github.com/HMS-Core/hms-ads-demo-java/pulls).\n\n##  License\nThe sample code is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHMS-Core%2Fhms-ads-demo-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHMS-Core%2Fhms-ads-demo-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHMS-Core%2Fhms-ads-demo-java/lists"}