Container Shooter project is a game that you need to deliver your cargo to the truck.
Analytics & Crashlytics If you just want to use Analytics & Crashlytics, you can see the coding for these in the project.
Android SDK min 21 Net 4.x
This plugin supports:
- Unity version 2019, 2020 - Developed in 2.0 Branch
- Unity version 2018 - Developed in 2.0-2018 Branch
Make sure to download the corresponding unity package for the Unity version you are using from the release section
Please check our wiki page
- Register your app at Huawei Developer
- Import the Plugin to your Unity project
- Connect your game with the HMS Kit Managers
1.1- Register at Huawei Developer
During this step, you will create an app in AppGallery Connect (AGC) of HUAWEI Developer. When creating the app, you will need to enter the app name, app category, default language, and signing certificate fingerprint. After the app has been created, you will be able to obtain the basic configurations for the app, for example, the app ID and the CPID.
- Sign in to Huawei Developer and click Console.
- Click the HUAWEI AppGallery card and access AppGallery Connect.
- On the AppGallery Connect page, click My apps.
- On the displayed My apps page, click New.
- Enter the App name, select App category (Game), and select Default language as needed.
- Upon successful app creation, the App information page will automatically display. There you can find the App ID and CPID that are assigned by the system to your app.
Set the package name of the created application on the AGC.
- Open the previously created application in AGC application management and select the Develop TAB to pop up an entry to manually enter the package name and select manually enter the package name.
- Fill in the application package name in the input box and click save.
Your package name should end in .huawei in order to release in App Gallery
Create a keystore using Unity or Android Tools. make sure your Unity project uses this keystore under the Build Settings>PlayerSettings>Publishing settings
During this step, you will need to export the SHA-256 fingerprint by using keytool provided by the JDK and signature file.
-
Open the command window or terminal and access the bin directory where the JDK is installed.
-
Run the keytool command in the bin directory to view the signature file and run the command.
keytool -list -v -keystore D:\Android\WorkSpcae\HmsDemo\app\HmsDemo.jks
-
Enter the password of the signature file keystore in the information area. The password is the password used to generate the signature file.
-
Obtain the SHA-256 fingerprint from the result. Save for next step.
During this step, you will configure the generated SHA-256 fingerprint in AppGallery Connect.
- In AppGallery Connect, click the app that you have created and go to Develop> Overview
- Go to the App information section and enter the SHA-256 fingerprint that you generated earlier.
- Click √ to save the fingerprint.
To import the plugin:
- Download the .unitypackage
- Open your game in Unity
- Choose Assets> Import Package> Custom
- In the file explorer select the downloaded HMS Unity plugin. The Import Unity Package dialog box will appear, with all the items in the package pre-checked, ready to install.
- Select Import and Unity will deploy the Unity plugin into your Assets Folder
In order for the plugin to work, some kits are in need of agconnect-json file. Please download your latest config file from AGC and import into Assets/StreamingAssets folder.
In order for the plugin to work, you need to select the needed kits Huawei > Kit Settings.
In this Ads Kit reference game , i selected the Ads Kit.
It will automaticaly create the GameObject for you and it has DontDestroyOnLoad implemented so you don't need to worry about reference being lost.
Now you need your game to call the Ads Kit Manager from your game. See below for further instructions.
There is a custom editor in Huawei > Kit Settings > Ads tab.
You can enable/disable ad types that you want in your project. Insert your Ad Id into these textboxes in the editor.
If you want to use test ads, you can check UseTestAds checkbox that'll overwrite all ad ids with test ads.
If you want your banner ad shown as soon as application launch you can check Show Banner on Load* checbox.
Then you can call certain functions such as
HMSAdsKitManager.Instance.ShowBannerAd();
HMSAdsKitManager.Instance.HideBannerAd();
HMSAdsKitManager.Instance.ShowInterstitialAd();
HMSAdsKitManager.Instance.OnRewarded = OnRewarded;
HMSAdsKitManager.Instance.ShowRewardedAd();
public void OnRewarded(Reward reward)
{
}
This reference game project's GameManager script can be observed as an example for ads integration
Banner Ad
Interstitial Ad
Rewarded Ad
1.If you received package name error , please check your package name on File->Build Settings -> Player Settings -> Other Settings -> Identification
2.If you received min sdk error ,
please set your API level as implied in the Requirements section