Overview
In this article, I will create a demo game and integrate Huawei Ads Kit. So the developer can easily monetise their efforts using Reward Ads and Interstitial Ads. I will cover every aspect of the game development with Huawei Ads Kit.
Service Introduction
Ads kit is powered by Huawei which allows the developer to monetization services such as Reward Ads and Interstitial ads. HUAWEI Ads Publisher Service is a monetization service that leverages Huawei's extensive data capabilities to display targeted, high-quality ad content in your game to the vast user base of Huawei devices.
Prerequisite
1. Unity Engine (Installed in the system)
2. Huawei phone
3. Visual Studio 2019
4. Android SDK & NDK (Build and Run)
Integration process
1. Sign In and Create or Choose a project on AppGallery Connect portal.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
2. Navigate to Project settings and download the configuration file.
Game Development
1. Create a new game in Unity.
2. Click 3D, enter Project Name, and then click to CREATE.
3. Now add game components and let us start game development.
4. Download HMS Unity Plugin from below site.
https://github.com/EvilMindDevs/hms-unity-plugin/releases
5. Open Unity Engine and import the downloaded HMS Plugin.
Choose Assets > Import Package> Custom Package
6. Choose Huawei > App Gallery.
7. Provide the AppId and other details from agconnect-service.json file and click configure Manifest.
8. Create Huawei Ads based scripts.
I have created AdsDemoManager.cs file in which integrated Huawei Ads which display Reward Ad and Interstitial Ad functionality.
Click on AdsDemoManager.cs and open in Visual Studio 2019
For codes and detailed information, you can check https://forums.developer.huawei.com/forumPortal/en/topic/0203424621102710033
It can be Useful.
Rebis said:
It can be Useful.
Click to expand...
Click to collapse
It will quite great
How can we configure rewards on server ?
Related
Huawei GameService supports unity .
You can follow list to integrate game service to Unity .
We use UDP(Unity Distribution Portal) that allows you to distribute your games to multiple app stores through a single hub.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Note : Before you begin operation You must learn UDP and How it works.for this reason you can visit this pageshttps://docs.unity3d.com/Packages/[email protected]/manual/Before_you_begin_know_this.html)
(https://docs.unity3d.com/Packages/c...al/Configuring_Unity_Distribution_Portal.html)
Integrate UDP SDK : To use UDP in-app purchases, implement the integration on the client and the server sides. If your game is offline, you only need to implement the client-side integration. If your game is online, you can opt to also implement the server-side integration...
(for details : https://docs.unity3d.com/Packages/c...manual/Implementing_UDP_in-app_purchases.html )
Download & integrate UDP specified Huawei AppGallery Game Services : Game Service helps you build basic game functions such as achievements, leaderboards, and saved games at low costs.
(Details : https://assetstore.unity.com/packages/add-ons/services/huawei-appgallery-game-services-164354 )
to learn information about Huawei GameService visit this Link
Build game with UDP SDK and Huawei AppGallery Game Services in Unity Editor : Building your game and deploying it to the UDP console.
(Details: https://docs.unity3d.com/Packages/c...game_and_deploying_it_to_the_UDP_console.html)
Upload game to UDP Console and prepare Game : The UDP console is a web-based platform where you can manage your games before submitting them to stores.
(Detail: https://docs.unity3d.com/Packages/c..._publishing_your_game_on_the_UDP_console.html)
Register game to Huawei AppGallery : Now we must register on Huawei AppGallery follow this Page
(Detail : https://distribute.dashboard.unity.com/guideDoc/HUAWEI )
Submit game to Huawei AppGallery :After all steps were done successfully you can submit game using UDP Console.
UDP Console -> [Game Detail] -> Publish page.
Configure Huawei specific steps in Huawei AppGallery : You visit this page and read mandatory section (Detail:https://distribute.dashboard.unity.com/guideDoc/HUAWEI)
More information about this, please visit HUAWEI Developers.
Any questions about this process, you can try to acquire answers from HUAWEI Developer Forum.
More information like this, you can visit HUAWEI Developer Forum
SDK Description
To integrate HUAWEI Drive Kit into your app, you will need to integrate both the HMS SDK and the Drive SDK. The HMS SDK provides sign-in and authentication information, while the Drive SDK provides the capability of managing users' files in Drive.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Integrating the Drive SDK and HMS SDK
If you are using Android Studio, you can integrate your Drive SDK and HMS SDK by using the Maven repository. Before you start developing an app, integrate both the Drive SDK and HMS SDK into your Android Studio first.
1. Add the AppGallery Connect configuration file of the app to your Android Studio.
a. Sign in to AppGallery Connect and select My projects.
b. Find your project from the project list and click the app on the project card.
c. On the Project Setting page, click agconnect-services.json to download the configuration file.
d. Copy the agconnect-services.json file to the app root directory.
2. Configure the Maven repository address for the HMS SDK.
a. Open the build.gradle file in the root directory of your Android Studio project.
3. Add build dependencies.
a. Open the build.gradle file in the app directory.
5. Define multi-language settings.
By default, your app supports all languages provided by the HMS SDK.If your app uses all these languages, skip the operation procedure in this section.
If your app uses only some of these languages, follow the operation procedure in this section to complete the required configuration.
Open the build.gradle file in the app directory of your project.
Go to android > defaultConfig and add the resConfigs configuration. en (English) and zh-rCN (Simplified Chinese) are mandatory languages. If your app only supports English and Simplified Chinese, the configuration is as follows:
1. Creating a Game on the Cocos Console
Create a game on the Cocos console as instructed (https://account.cocos.com/#/game/game_list).
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
2. Creating a Game in HUAWEI AppGallery Connect
Step 1: Create a project in AppGallery Connect and add your app to the project.
Set Platform to Android, Device to Mobile phone, and App category to App or Game based on your needs.
Step 2: Configure the signing certificate fingerprint.
Go to Project settings > General information. In the App information area, click the icon next to SHA-256 certificate fingerprint, and enter the obtained SHA-256 certificate fingerprint.
Step 3: Enable the services you need.
Go to My projects > Project settings > Manage APIs, and enable the APIs you need to use.
If your app includes in-app purchases, go to Earn > In-App Purchases, and click Settings to enable HUAWEI IAP.
Step 4: (Optional) Configure achievements and events for your game.
For details, see the official documentation.
3. Associating a Game in Cocos Creator
You can enable third-party services for your app in Cocos Creator. But first, you need to set a Cocos AppID. Select a created game, and click Association, as shown in the following figures.
4. Integrating Cocos SDKHub
After Cocos SDKHub is integrated, you can run the sdkhub command in Developer Tools to access related APIs and functions.
5. Configuring Cocos SDKHub
1. Configuring a plug-in: Click Config Plugin, select the Huawei services to be enabled, and click OK.
2. Setting parameters: Click the following button and set parameters in the dialog box that is displayed.
Obtain the payment public key from Earn > In-App Purchases in AppGallery Connect.
Now that you have integrated Cocos SDKHub, you can develop your game in the Cocos development environment.
Next time, we'll take a look at how to package and release an app in AppGallery Connect.
For more details, check:
AppGallery Connect documentation:
https://developer.huawei.com/consumer/en/doc/distribution/app/agc-create_app
Cocos SDKHub Quick Start:
https://docs.cocos.com/creator/manual/en/cocos-service/sdkhub.html
You can release a Cocos-based game in HUAWEI AppGallery Connect.
1. Building Your Version
Sign in to Cocos Creator, choose Project > Build & Release, and perform configurations as follows:
Select HUAWEI AppGallery Connect as the release platform.
For a joint operations app or game, the package name must end with*.huawei.
Use the keystore information configured previously.
In Cocos SDKHub, select the HUAWEI AppGallery Connect config set you need.
You are advised to deselect Debug Mode. All Huawei SDK APIs require app signature verification, if Debug Mode is selected, the compiler does not sign your app package by default.
2. Compiling Your Version
You can either compile your game in Cocos Creator or Android Studio.
2.1 Compiling in Cocos Creator
In Cocos Creator, go to Project > Build…, and click Compile after the build is complete.
After compilation, you can find the file in $ProjectHome\build\jsb-link\publish\android.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
2.2 Compiling in Android Studio
Open the following directory in Android Studio and compile your game.$ProjectHome \build\jsb-link\frameworks\runtime-src\proj.android-studio
3. Uploading Your Version
You can release your game version either by uploading it in Cocos Creator directly after build and compilation, or by uploading the compiled file in AppGallery Connect.
Method 1: Click Upload next to Compile in Cocos Creator. Select a login type, and enter the app ID of your game, which was generated by AppGallery Connect. You can set other parameters according to the actual situation. Click Confirm, and verify your HUAWEI ID in the displayed dialog box. After verification, your game version will be uploaded to AppGallery Connect. You can later sign in to AppGallery Connect and go to My apps > Distribute > Version information to view it.
Method 2: Sign in to AppGallery Connect, go to My apps > Distribute > Version information, click Software package management, and upload your app package.
For more details, check:
Integrating HUAWEI Game Service Based on Cocos SDKHub - Integrating Cocos SDKHub:https://forums.developer.huawei.com/forumPortal/en/topic/0203404602609800136
AppGallery Connect documentation:https://developer.huawei.com/consumer/en/doc/distribution/app/agc-release_app
HMS Toolkit is an IDE plugin which provides all the tools you need to develop and release HMS Core-integrated apps in Android Studio. You can use it to create, code, convert, debug, test, and release your apps, and it cuts the cost of development and boosts efficiency by more than three times.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
l Functions
Configuration Wizard enables you to quickly prepare your environment for the integration of HMS Core kits. The configuration process originally comprised 14 steps, during which you had to frequently switch between the IDE and AppGallery Connect. But with this tool, you can automatically configure a full environment, including your team, project module, AppGallery Connect file, and project certificate. It saves a lot of preparation time and improves your efficiency when developing.
l Highlights
Automatic configuration with one click
Streamlines the configuration process.
No need to keep checking documents or switching tools.
Various configuration scenarios
Supports configuring multiple kits at the same time.
Supports all kits for which development preparations are required.
Efficiency boost
Shortens the configuration process from 4 hours to 5 minutes.
Provides you with clear guidance.
l Usage
If you have any questions, please submit a ticket. Huawei technical support will reply to you as soon as possible.
For more information about HMS Toolkit, go to >>
For how to quickly integrate each kit using HMS Toolkit, go to >>
For more operation tutorials, go to >>
For more details, you can go to:
l Our official website
l Our Development Documentation page, to find the documents you need
l Reddit to join our developer discussion
l GitHub to download demos and sample codes
l Stack Overflow to solve any integration problems
Original Source