This package enables parts of Hms Core service in Unity for Android Build, which is implemented by wrapping Hms SDK. Name and usage of corresponding classes and functions are the same. You can write code by referring [Hms SDK document](https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/account-introduction-v4). But still there are some differences during development. We highly recommend downloading [example project](https://github.com/Unity-Technologies/HMSSDKSample) as a reference.
There are 4 Kits included.
* Ads Kit: [reference](https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/ads-sdk-development-process) and [param](https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/ads-sdk-development-process)
* Rewarded Ads
* Interstitial Ads
* Push Kit: [reference](https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/push-use-cases) and [param](
Before doing this step, you need to create HMS Account and project according to [the HMS document](https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/Preparations).
In this step, we will setup build environment for building Android apk with HMS SDK. After finish the following preparation.
`We must generate agconnect-services.json if we use analytic, push or location sdk.`
Reference [Link](https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-config-agc-0000001050170137) to create agconnect-services.json
For getting the activity, you can use the following code.
There are corresponding example scene in [example project](https://github.com/Unity-Technologies/HMSSDKSample) for all 4 Kits. For test, you need to build it onto Android mobile build by HMS. Make sure you have created HMS account and project. Then, you can change the configuration and test different functions.
## Ads
In example project, corresponding scene is `Assets/HuaweiHmsDemo/Scenes/HmsAdsSampleScene.unity` and code is `Assets/HuaweiHmsDemo/demo/test/ads/AdsTest.cs`.
In example project, corresponding scene is `Assets/HuaweiHmsDemo/Scenes/HmsAnalyticSampleScene.unity` and code is `Assets/HuaweiHmsDemo/demo/test/AnalyticTest.cs`.
***Analytic initialize must initialize on `onCreate` of the first activity .***
You can extend the UnityPlayerActivity file, and put java file on `Plugins/Android`.
```
</application>
```
**if you initialize analytic, you should add analytic implentment on mainTemplate.gradle**
### Push
## Push
In example project, corresponding scene is `Assets/HuaweiHmsDemo/Scenes/HmsPushSampleScene.unity` and code is `Assets/HuaweiHmsDemo/demo/test/PushTest.cs`.
We must set service.
1. Implement interface `IPushServiceListener`
2. Get Receiver by method `PushListenerRegister.RegisterListener`
</application>
```
`android:name` is fixed.
### Location
## Location
In example project, corresponding scene is `Assets/HuaweiHmsDemo/Scenes/HmsLocationSampleScene.unity` and code is `Assets/HuaweiHmsDemo/demo/test/location/LocationTest.cs`.
#### LocationBroadcastReceiver
### LocationBroadcastReceiver
1. Implement interface `IBroadcastReceiver`
2. Get Receiver by method `BroadcastRegister.CreateLocationReceiver`
3. add to AndroidManifest.xml
`android:name` is fixed.
You can set value of `action android:name`. But the value should be the same as the parameter of `intent.setAction`.
#### GeoFenceReceiver
### GeoFenceReceiver
1. Implement interface `IBroadcastReceiver`
2. Get Receiver by method `BroadcastRegister.CreateGeoFenceReceiver`