Location Kit combines the GNSS, Wi-Fi, and base station location functionalities into your app to build up global positioning capabilities, allowing you to provide flexible location-based services for global users. Currently, it provides three main capabilities: fused location, activity identification, and geofence. You can call one or more of these capabilities as needed.
1.1 Version Change History
1.1.1 Version Dependencies and Restrictions
For details, please refer to the development guide.
1.2 Preparations
1.2.1 Importing Unity Assets
1.2.2 Generating .gradle Files
1. Enable project gradle.
Go to Edit > Project Settings > Player in Unity, click the Android icon, and go to Publishing Settings > Build.
Enable Custom Main Manifest.
Enable Custom Main Gradle Template.
Enable Custom Launcher Gradle Template.
Enable Custom Base Gradle Template.
2. Generate a signature.
You can use an existing keystore file or create a new one to sign your app.
Go to Edit > Project Settings > Player in Unity, click the Android icon, and go to Publishing Settings > Keystore Manager.
Then, go to Keystore… > Create New.
Enter the password when you open Unity. Otherwise, you cannot build the APK.
1.2.3 Configuring .gradle Files and the AndroidManifest.xml File
1. Configure the baseProjectTemplate.gradle file.
2. Configure the launcherTemplate.gradle file.
4. Configure the AndroidManiest.xml file.
1.2.4 Adding the agconnect-services.json File
1. Create an app by following instructions in Creating an AppGallery Connect Project and Adding an App to the Project.
Run keytool -list -v -keystore C:\TestApp.keyStore to generate the SHA-256 certificate fingerprint based on the keystore file of the app. Then, configure the fingerprint in AppGallery Connect.
2. Download the agconnect-services.json file and place it in the Assets/Plugins/Android directory of your Unity project.
1.2.5 Enabling Location Kit
1. Sign in to AppGallery Connect.
2. Go to My projects > Project settings > Manage APIs, and enable the Location Kit API.
1.3 Official Asset Sample Code
For details, please visit the following link:
https://docs.unity.cn/cn/Packages-cn/com.unity.hms@1.2/manual/
1.3.1 Testing the APK
1.3.1.1 Testing the APK
1. Generate the APK.
Go to File > Build Settings > Android, click Switch Platform and then Build And Run.
2. Create a geofence in AppGallery Connect. For details, please visit the following link:
For more details, you can go to:
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 URL