Integrating HUAWEI Location Kit Using Unity - Huawei Developers

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​
{
"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"
}
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.
Java:
<p style="line-height: 1.5em;">allprojects {
buildscript {
repositories {**ARTIFACTORYREPOSITORY**
google()
jcenter()
maven { url 'https://developer.huawei.com/repo/' }
}
dependencies {
// If you are changing the Android Gradle Plugin version, make sure it is compatible with the Gradle version preinstalled with Unity.
// For the Gradle version preinstalled with Unity, please visit https://docs.unity3d.com/Manual/android-gradle-overview.html.
// For the official Gradle and Android Gradle Plugin compatibility table, please visit https://developer.android.com/studio/releases/gradle-plugin#updating-gradle.
// To specify a custom Gradle version in Unity, go do Preferences > External Tools, deselect Gradle Installed with Unity (recommended) and specify a path to a custom Gradle version.
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.huawei.agconnect:agcp:1.2.1.301'
**BUILD_SCRIPT_DEPS**
}
}
repositories {**ARTIFACTORYREPOSITORY**
google()
jcenter()
flatDir {
dirs "${project(':unityLibrary').projectDir}/libs"
}
maven { url 'https://developer.huawei.com/repo/' }
}
}</p>
2. Configure the launcherTemplate.gradle file.
Java:
<p style="line-height: 1.5em;">dependencies {
implementation 'com.huawei.agconnect:agconnect-core:1.2.0.300'
implementation 'com.huawei.hms:base:4.0.1.300'
implementation 'com.huawei.hms:hwid:4.0.1.300'
implementation 'com.huawei.hms:location:5.0.0.302'
...
}
3. Configure the mainTemplate.gradle file.
dependencies {
...
implementation 'com.huawei.agconnect:agconnect-core:1.2.0.300'
implementation 'com.huawei.hms:base:4.0.1.300'
...
**DEPS**}</p>
4. Configure the AndroidManiest.xml file.
XML:
<p style="line-height: 1.5em;"><?xml version="1.0" encoding="utf-8"?>
<!-- Generated by Unity. Remove this comment to prevent overwriting when exporting again. -->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="com.huawei.hms.permission.ACTIVITY_RECOGNITION" />
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application>
<activity android:name="com.hms.hms_analytic_activity.HmsAnalyticActivity"
android:theme="@style/UnityThemeSelector">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="unity.cn"
android:scheme="https" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
<receiver
android:name="com.unity.hms.location.LocationBroadcastReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.huawei.hmssample.location.LocationBroadcastReceiver.ACTION_PROCESS_LOCATION" />
</intent-filter>
</receiver>
<receiver
android:name="com.unity.hms.location.GeoFenceBroadcastReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.huawei.hmssample.geofence.GeoFenceBroadcastReceiver.ACTION_PROCESS_LOCATION" />
</intent-filter>
</receiver>
</application>
</manifest></p>
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:
App Services(HMS) | Hms Core App Services | 1.2.0
docs.unity.cn
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:
Create a geofence in AppGallery Connect
Read full article in forum

Related

How Can I Quickly Integrate App Linking of AppGallery Connect into My Android App?

Recently, my app needs to use cross-platform sharing links. App Linking of AppGallery Connect just meets my requirements.
Perform the following steps for service integration:
i. Step 1: Create an app and enable App Linking for the app.
ii. Step 2: Create a URL prefix.
iii. Step 3: Integrate the App Linking SDK into the Android project.
iv. Step 4: Create a link of App Linking.
v. Step 5: Receive and test the link.
1. Creating an App and Enabling App Linking for the App
Create an app or use an existing app in AppGallery Connect. Click My projects and go to Grow > App Linking, and click Enable now in the displayed page.
{
"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"
}
Go to My projects > Project settings > General information, download the agconnect-services.json file, and save the file to the app directory of your Android project.
2. Creating a URL Prefix
On the displayed App Linking service page, click the URL prefix tab and then click Add URL prefix to create a unique URL prefix.
The system will automatically check your domain name to ensure its uniqueness.
3. Integrating the App Linking SDK into Your Android Project
To configure the SDK address, open your Android project, and configure the following content in red in the project-level build.gradle file.
XML:
buildscript {
repositories {
// ...
maven {url 'https://developer.huawei.com/repo/'}
}
dependencies {
// ...
classpath 'com.huawei.agconnect:agcp:1.4.1.300'
}
}
allprojects {
repositories {
// ...
maven {url 'https://developer.huawei.com/repo/'}
}
}
Open the app-level build.gradle file and configure the App Linking SDK and Analytics SDK by adding the following information in red:
XML:
...
apply plugin: 'com.huawei.agconnect'
...
dependencies {
...
implementation "com.huawei.agconnect:agconnect-applinking:1.4
implementation 'com.huawei.hms:hianalytics:5.0.4.301'.1.300"
}
4. Creating a Link of App Linking
You can create a link of App Linking in AppGallery Connect or call an API in your Android project.
4.1 Creating a Link in AppGallery Connect
1. On the displayed App Linking service page, click the App Linking tab and create a link as prompted.
2. Configure the deep link of Android.
3. Set Link behavior for Android to Open in app.
After the link is successfully created, copy and use it.
4.2 Creating a Link Through Coding
1. In the activity_main.xml file, configure two buttons, one for link creation and the other for sharing. Create a TextView to display the link.
HTML:
<Button
android:id="@+id/create"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Create App Linking"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.4" />
<TextView
android:id="@+id/showLink"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="your App Linking"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.5" />
<Button
android:id="@+id/shareLink"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Share App Linking"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.8" />
Refer to the figure as follows.
2. Copy and add the URL prefix, and set the deep link to be opened.
Java:
private static final String DOMAIN_URI_PREFIX = "https://testapplinking1016.drcn.agconnect.link";
private static final String DEEP_LINK = " https://consumer.huawei.com/cn/";
private static final String Android_DEEP_LINK = "myapp://testapplinking/?data=1016";
private String shortLink;
3. In onCreate of MainActivity, you can add a CREATE APP LINKING button to create a link.
Java:
findViewById(R.id.create).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AppLinking.Builder builder = new AppLinking.Builder()
.setUriPrefix(DOMAIN_URI_PREFIX)
.setDeepLink(Uri.parse(DEEP_LINK))
.setAndroidLinkInfo(new AppLinking.AndroidLinkInfo.Builder()
.setAndroidDeepLink(Android_DEEP_LINK).build());.build());
builder.buildShortAppLinking().addOnSuccessListener(shortAppLinking -> {
shortLink = shortAppLinking.getShortUrl().toString();
TextView showAppLinking = findViewById(R.id.showLink);
showAppLinking.setText(shortLink);
}).addOnFailureListener(e -> {
Log.e("AppLinking", "Failure + "+ e.getMessage());
});
}
});
4. Then, you can tap SHARE APP LINKING in your app to share the created link.
Java:
findViewById(R.id.shareLink).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, shortLink);
startActivity(intent);
}
});
5. Receiving a Link
To receive a link, you need to configure the manifest file and set the getAppLinking method to the link entry.
1. Configure the manifest file. Here, the scheme of the deep link domain name is set in the file.
Example: DEEP_LINK = “myapp://testapplinking/?data=1016”;
private static final String DEEP_LINK = "myapp://testapplinking/?data=1016";
Sample code:
XML:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="testapplinking" android:scheme="myapp" />
</intent-filter>
2. In the main entry of onCreate, set getAppLinking to obtain and display the link.
Java:
AGConnectAppLinking.getInstance().getAppLinking(this).addOnSuccessListener(resolvedLinkData -> {
if (resolvedLinkData != null) {
String Result = resolvedLinkData.getDeepLink().toString();
TextView showAppLinking = findViewById(R.id.showLink);
showAppLinking.setText(Result);
}
});
6. Packaging Your App and Testing App Linking
1. After your app runs properly, tap CREATE APP LINKING to create a link. The link is displayed on the app screen.
2. Tap SHARE APP LINKING to share the link to the note. Then tap the link in the note and open the link in a browser. If the browser can directly open your app, the test is successful.
(The test process is the same for the link created in AppGallery Connect.)
For more details, please check:
https://developer.huawei.com/consum...ry-connect-Guides/agc-applinking-introduction
7. Summary
The integration is simple. The SDK is small, and links can be shared across Android and iOS. No adaptation is required on different platforms, reducing the workload.
Operations personnel can create links in AppGallery Connect for app promotion, and developers can write code in apps to create links, which is very convenient.
Reference:
HUAWEI AppGallery Connect App Linking documentation: https://developer.huawei.com/consum...ry-connect-Guides/agc-applinking-introduction

Beginner: Huawei App Messaging Unity Game Development

Introduction
You can use App Messaging of AppGallery Connect to subscribe and send relevant messages to target active users of your app to encourage them to use key app functions. For example, you can send in-app messages to encourage users to subscribe certain products, provide tips on passing a game level or recommend activities of a restaurant.
App Messaging allows you to customize our messages look and the way they will be sent, and define events for triggering message sending to your users at the right moment.
AG Connect supports three types of messages as follows:
1. Pop-up message
2. Image message
3. Banner message
Development Overview
You need to install Unity software and I assume that you have prior knowledge about the unity and C#.
Hardware Requirements
A computer (desktop or laptop) running Windows 10.
A Huawei phone (with the USB cable), which is used for debugging.
Software Requirements
Java JDK installation package.
Unity software installed.
Visual Studio/Code installed.
HMS Core (APK) 4.X or later.
Follows the steps.
1. Create Unity Project.
Open unity Hub.
Click NEW, select 3D, Project Name and Location.
Click CREATE, as follows:
{
"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. Click Asset Store, search Huawei HMS Core App Services and click Import, as follows.
3. Once import is successful, verify directory in Assets> Huawei HMS Core App Services path, as follows.
4. Choose Edit > Project Settings > Player and edit the required options in Publishing Settings, as follows.
5. Generate a SHA-256 certificate fingerprint.
To generating SHA-256 certificate fingerprint use below command.
Code:
keytool -list -v -keystore D:\Unity\projects_unity\file_name.keystore -alias alias_name
6. Download agconnect-services.json and copy and paste to Assets > Plugins > Android, as follows.
7. Choose Project Settings > Player and update package name.
8. Open LauncherTemplate.gradle and add below line.
Code:
apply plugin: 'com.huawei.agconnect'
implementation 'com.huawei.hms:hianalytics:5.1.0.301'
implementation 'com.huawei.agconnect:agconnect-core:1.4.2.301'
9. Open AndroidManifest file and add below permissions.
Code:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
10. Open "baseProjectTemplate.gradle" and add lines, as follows.
Code:
classpath'com.huawei.agconnect:agcp:1.4.1.300'
maven {url 'https://developer.huawei.com/repo/'}
11. Open "mainTemplate.gradle" and add lines, as follows.
Code:
implementation 'com.huawei.agconnect:agconnect-core:1.4.2.301'
implementation 'com.huawei.hms:hianalytics:5.1.0.301'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.huawei.agconnect:agconnect-appmessaging:1.4.1.300'
12. Enable debug mode use in cmd prompt [optional].
Code:
adb shell setprop debug.huawei.hms.analytics.app package_name
13. Configuring project in AGC
14. Create Scripts folder and create a class.
APPMessaging.cs
C#:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HuaweiService;
using HuaweiService.appmessage;
using HuaweiService.analytic;
using HuaweiService.push;
using Exception = HuaweiService.Exception;
public class APPMessaging : MonoBehaviour
{
private HiAnalyticsInstance instance;
private AGConnectAppMessaging appMessaging;
private void Start()
{
instance = HiAnalytics.getInstance(new Context());
appMessaging = AGConnectAppMessaging.getInstance();
appMessaging.setFetchMessageEnable(true);
appMessaging.setDisplayEnable(true);
instance.setAnalyticsEnabled(true);
getAAID();
}
private void getAAID(){
// Task result = instance.getAAID();
Task id = HmsInstanceId.getInstance(new Context()).getAAID();
id.addOnSuccessListener(new HmsSuccessListener<AAIDResult>((aaidResult) =>
{
string aaId = aaidResult.getId();
Debug.Log("AAID==>> "+aaId);
})).addOnFailureListener(new HmsFailureListener((e) =>
{
Debug.Log("AAID==>> Failed");
}));
}
public delegate void SuccessCallBack<T>(T o);
public class HmsSuccessListener<T>:OnSuccessListener{
public SuccessCallBack<T> CallBack;
public HmsSuccessListener(SuccessCallBack<T> c){
CallBack = c;
}
public void onSuccess(T arg0)
{
if(CallBack != null)
{
CallBack.Invoke(arg0);
}
}
public override void onSuccess(AndroidJavaObject arg0){
if(CallBack !=null)
{
Type type = typeof(T);
IHmsBase ret = (IHmsBase)Activator.CreateInstance(type);
ret.obj = arg0;
CallBack.Invoke((T)ret);
}
}
}
public delegate void SuccessCallBack(AndroidJavaObject object);
public delegate void FailureCallBack(Exception e);
public class HmsFailureListener:OnFailureListener{
public FailureCallBack CallBack;
public HmsFailureListener(FailureCallBack c){
CallBack = c;
}
public override void onFailure(Exception arg0){
if(CallBack !=null){
CallBack.Invoke(arg0);
}
}
}
}
AndroidManifest.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN-->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application>
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:theme="@style/UnityThemeSelector">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
</application>
</manifest>
15. Follow the steps, as shown in image:
a. Create empty GameObject.
b. Assign script APPMessaging(as per you script name) to empty GameObject.
16. To build apk and run in device, choose File > Build Settings > Build for apk or Build and Run for run on connected device.
Result
Sign in to AppGallery Connect and click My projects.
Find and click your project.
Navigate to Grow > App Messaging and click New.
Select Name and Description.
Click Test in Operation drop-down.
Enter text in Test user AAID and click Save.
Tips and Tricks
Always use the latest version of the library.
Add agconnect-services.json file without fail.
Add SHA-256 fingerprint without fail.
Make sure dependencies added in build files.
Make sure you have enable debug mode.
Make sure the image url is correct and aspect ratio for Portrait is 3:2 (300x200) and Landscape aspect ratio is 1:1 or 3:2 (100 x100 or 300x200).
Conclusion
In this article, we have learnt to integrate Huawei AppMessaging service into unity game development. AppMessaging provides services sending promotional messages and new updates and also we can target users to promote some products.
Thanks for reading the article, please do likes, comments and your queries or suggestions.
References
App Messaging - click here
Unity App Messaging Integration Manual - click here
Original source

Expert: Integration of Google Tag Manager and Huawei Dynamic Tag Manager for Firebase Android App

Overview
In this article, I will create an Android Demo app that highlights use case of Google Tag Manager and Dynamic Tag Manager in a Single Android App. I have integrated Huawei Analytics and Google Analytics.
I will create an AppGallery project and deploy AppGallery into the application. I will fire a basic event, so we can debug the hits sent from AppGallery to Huawei Analytics.
I will create a Google Tag Manager container for Firebase, and I will install that in application. I will use that container to take the event when we configured Firebase and will send the data to a (non-Firebase) Google Analytics property as well.
Huawei Analytics Introduction
Analytics kit is powered by Huawei which allows rich analytics models to understand user behaviour and gain in-depth insights into users, products, and content. As such, you can carry out data-driven operations and make strategic decisions about app marketing and product optimization.
Analytics Kit implements the following functions using data collected from apps:
1. Provides data collection and reporting APIs for collection and reporting custom events.
2. Sets up to 25 user attributes.
3. Supports automatic event collection and session calculation as well as predefined event IDs and parameters.
Google Analytics Introduction
Google Analytics collects usage and behaviour data for your app. The SDK logs two primary types of information:
Events: What is happening in your apps, such as user actions, system events, or errors?
User properties: Attributes you define to describe segments of your user base, such as language preference or geographic location.
Analytics automatically logs some events and user properties, you don't need to add any code to enable them.
Dynamic Tag Manager Introduction
Dynamic Tag Manager is a concept of improving collaboration between developers and marketers. It eliminates the need for restructuring application code as a result of new marketing intelligence requirements.
Dynamic Tag Manager console allows you to define different tags and manage the rules that trigger them. One specific tag type is the Universal Analytics tag, which enables you to integrate your Huawei Analytics project with Dynamic Tag Manager. This tag is easily set up by associating it with your Analytics key. This will expose the tags you are firing to your Analytics project in their raw form. From that point, you can define what data is sent to your Analytics project, when and how, without the need of changing your application’s code-of course, assuming you have smartly integrated the Huawei Dynamic Tag Manager’s SDK into your app in the first place.
Google Tag Manager
Google Tag Manager enables developers to change configuration values in their mobile application using the Google Tag Manager interface without having to rebuild and resubmit application binaries to app marketplaces.
This is useful for managing any configuration values or flags in your application that you may need to change in the future, including:
Various UI settings and display strings.
Sizes, locations, or types of ads served in your application.
Various Game settings.
Configuration values may also be evaluated at runtime using rules, enabling dynamic configurations such as:
Using screen size to determine ad banner size.
Using language and location to configure UI elements.
Google TagManager also enables the dynamic implementation of tracking tags and pixels in applications. Developers can push important events into a data layer and decide later which is tracking tags or pixels should be fired.
Prerequisite
1. Android Studio
2. Huawei phone
3. Firebase Account
4. AppGallery Account
App Gallery 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.
3. Navigate to General Information > Data Storage location.
4. Navigate to Manage APIs > Enable APIs.
5. Enable Huawei Analytics.
6. Enable Dynamic Tag Manager.
7. Create Tag.
8. Configure Tag.
9. Pause or Delete Tag.
Firebase Integration Process
1. Create a Firebase project.
2. Choose Android as a Platform.
3. Add App to your Firebase Project.
4. Download Configuration file.
5. Navigate to Google Tag Manager Console.
Create New Tag, then click Submit.
6. Choose tag type.
7. Choose a Variable
8. Tag Configure.
9. Publish Tag
10. Download the Tag and Add in your Android App.
(Your Project)Android App > Assets > Container > tag_file.
App Development
1. Create A New Project.
2. Configure Project Gradle.
Java:
buildscript {
repositories {
google()
jcenter()
maven { url 'https://developer.huawei.com/repo/' }
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.huawei.agconnect:agcp:1.3.1.300'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://developer.huawei.com/repo/' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
3. Configure App Gradle.
Java:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.huawei.agconnect'
android {
compileSdkVersion 30
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.gtm.dtm"
minSdkVersion 27
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
//Google Tag Manager with Analytics
implementation platform('com.google.firebase:firebase-bom:26.8.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.android.gms:play-services-tagmanager:17.0.0'
//Dynamic Tag Manager with Huawei Analytics
implementation "com.huawei.hms:hianalytics:5.2.0.300"
implementation "com.huawei.hms:dtm-api:5.2.0.300"
implementation 'in.shadowfax:proswipebutton:1.2.2'
}
4. Configure AndroidManifest.
XML:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gtm.dtm">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.google.android.gms.tagmanager"
android:noHistory="true">
<intent-filter>
<data android:scheme="tagmanager.c.com.example.app" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>
<meta-data
android:name="com.huawei.hms.client.channel.androidMarket"
android:value="false" />
</application>
</manifest>
5. Create an Activity class with XML UI.
MainActivity:
This activity performs all the operation of Huawei Analytics and Google Analytics based on button click events.
Java:
package com.gtm.dtm;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.huawei.hms.analytics.HiAnalytics;
import com.huawei.hms.analytics.HiAnalyticsInstance;
import in.shadowfax.proswipebutton.ProSwipeButton;
public class MainActivity extends AppCompatActivity {
private HiAnalyticsInstance instance;
private FirebaseAnalytics mFirebaseAnalytics;
private ProSwipeButton btnGTM;
private ProSwipeButton btnDTM;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mFirebaseAnalytics=FirebaseAnalytics.getInstance(this);
instance = HiAnalytics.getInstance(this);
btnGTM = (ProSwipeButton) findViewById(R.id.btn_gtm);
btnGTM.setOnSwipeListener(new ProSwipeButton.OnSwipeListener() {
@Override
public void onSwipeConfirm() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
btnGTM.showResultIcon(true);
sendGTMEvent();
}
}, 2000);
}
});
btnDTM = (ProSwipeButton) findViewById(R.id.btn_dtm);
btnDTM.setOnSwipeListener(new ProSwipeButton.OnSwipeListener() {
@Override
public void onSwipeConfirm() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
btnDTM.showResultIcon(true);
sendDTMEvent();
}
}, 2000);
}
});
}
private void sendDTMEvent() {
String eventName = "DTM";
Bundle bundle = new Bundle();
bundle.putString("Click", "Pressed button");
if (instance != null) {
instance.onEvent(eventName, bundle);
Log.d("DTM-Test","log event.");
}
}
private void sendGTMEvent(){
Bundle bundle = new Bundle();
bundle.putString("Click", "Pressed button");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.ADD_TO_CART, bundle);
}
}
main_activity.xml:
XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/bg">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:gravity="center_horizontal"
android:text="Google Tag Manager \n vs \n Dynamic Tag Manager"
android:textColor="#fff"
android:textSize="30dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:orientation="vertical"
android:padding="10dp">
<in.shadowfax.proswipebutton.ProSwipeButton
android:id="@+id/btn_dtm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:arrow_color="#33FFFFFF"
app:bg_color="@android:color/holo_red_dark"
app:btn_radius="2"
app:btn_text="Send DTM Event"
app:text_color="@android:color/white"
app:text_size="14sp" />
<in.shadowfax.proswipebutton.ProSwipeButton
android:id="@+id/btn_gtm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_marginTop="10dp"
app:arrow_color="#33FFFFFF"
app:bg_color="@android:color/holo_green_dark"
app:btn_radius="2"
app:btn_text="Send GTM Event"
app:text_color="@android:color/white"
app:text_size="14sp" />
</LinearLayout>
</RelativeLayout>
App Build Result
1. Google Analytics Debug View.
2. Huawei Analytics Overview.
3. App Result.
Tips and Tricks
1. 5.2.0 or later. If HMS Core (APK) is not installed or its version is earlier than 5.2.0, DTM functions can be normally used but the DTM SDK version cannot be updated automatically.
2. ICustomVariable and ICustomTag contain custom extensible variables and templates. You can also customize variables and templates in DTM to meet specific requirements.
Conclusion
In this article, we have learned how to integrate DTM and GTM in application. In this application, I have explained use case of Google tag manager with Dynamic Tag manager in a single application.
Thanks for reading this article. Be sure to like and comments on this article, if you found it helpful. It means a lot to me.
References
1. Huawei Tag Manager
2. Google Tag Manager Console
3. Google Firebase Console

Beginner: Integration of Huawei HEM Kit in Android

Introduction
Huawei provides various services for developers to make ease of development and provides best user experience to end users. In this article, we will cover integration of Huawei Enterprise Manager (HEM) Kit in Android.
Huawei Enterprise Manager (HEM) is a mobile device management solution provided for you based on the powerful platform and hardware of Huawei. The device deployment service in HEM helps install a Device Policy Controller (DPC) app automatically on enterprise devices in batches.
{
"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"
}
Development Overview
You need to install Android studio IDE and I assume that you have prior knowledge about the Android and java.
Hardware Requirements
A computer (desktop or laptop) running Windows 10.
A Huawei phone (with the USB cable), which is used for debugging.
An enterprise-oriented Huawei phone that has not been activated (running EMUI 11.0 or later). The bring your own device (BYOD) mode is not supported
Software Requirements
Java JDK installation package.
Android studio IDE installed.
HMS Core (APK) 5.X or later.
Follows the steps.
1. Create Android Project.
Open Android Studio.
Click NEW Project, select a Project Templet.
Enter project and Package Name and click on Finish:
2. Register as Huawei developer and complete identity verification in Huawei developer’s website, refer to register a Huawei ID.
3. To generate SHA-256 certificate fingerprint. On right-upper corner of android project click Gradle, choose Project Name > app > Tasks > android, and then click signingReport, as follows.
or
Also we can generate SHA-256 using command prompt.
To generating SHA-256 certificate fingerprint use below command.
4. Create an App in AppGallery Connect.
5. Download the agconnect-services.json file from AGC, copy and paste in android Project under app directory, as follows.
6. Add the below maven URL in build.gradle(Project level) file under the repositories of buildscript, , for more information refer Add Configuration.
Code:
maven { url 'https://developer.huawei.com/repo/' }
7. Add the below plugin and dependencies in build.gradle(App level).
Code:
apply plugin 'com.huawei.agconnect'
implementation "com.huawei.hms:hemsdk:1.0.0.303"
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
8. Open AndroidManifest file and add below permissions.
Code:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
9. Development Procedure.
1. Create a java class MainActivity.java inside your package.
MainActivity.java
Code:
package com.android.hemdemokit;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.huawei.hem.license.HemLicenseManager;
import com.huawei.hem.license.HemLicenseStatusListener;
public class MainActivity extends Activity {
private HemLicenseManager hemInstance;
private TextView resultCodeTV;
private TextView resultCodeDescTV;
private Button btnActive;
private Button btnDeActive;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
hemInstance = HemLicenseManager.getInstance(this);
setButtonClickListener();
setStatusListener();
}
private void setButtonClickListener() {
btnActive = findViewById(R.id.active_btn);
btnDeActive = findViewById(R.id.de_active_btn);
esultCodeTV = findViewById(R.id.result_code_tv);
resultCodeDescTV = findViewById(R.id.result_code_desc_tv);
btnActive.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
hemInstance.activeLicense();
}
});
btnDeActive.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
hemInstance.deActiveLicense();
}
});
}
private void setStatusListener() {
hemInstance.setStatusListener(new MyHemLicenseStatusListener());
}
private class MyHemLicenseStatusListener implements HemLicenseStatusListener {
@Override
public void onStatus(final int errorCode, final String msg) {
resultCodeTV.post(new Runnable() {
@Override
public void run() {
resultCodeTV.setText(String.valueOf(errorCode));
}
});
resultCodeDescTV.post(new Runnable() {
@Override
public void run() {
resultCodeDescTV.setText(msg);
}
});
}
}
}
2. Create activity_main.xml layout file under app > main > res > layout folder.
activity_main.xml
XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="14dp"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="return code:"
android:textSize="16dp" />
<TextView
android:id="@+id/result_code_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@null"
android:drawablePadding="10dp"
android:padding="10dp"
android:text="" />
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="14dp"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="result description:"
android:textSize="16dp" />
<TextView
android:id="@+id/result_code_desc_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@null"
android:drawablePadding="10dp"
android:padding="10dp"
android:text="" />
</LinearLayout>
<Button
android:id="@+id/active_btn"
android:text="call active"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/de_active_btn"
android:text="call de_active"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
10. To build apk and run in device, choose Build > Generate Signed Bundle/APK > Build for apk or Build and Run into connected device follow the steps.
Result
1. Install application into device and click on app icon you can see below result.
2. If the EMUI device is less than targeted device, then you will get below errors.
Tips and Tricks
Always use the latest version of the library.
Add agconnect-services.json file without fail.
Add SHA-256 fingerprint without fail.
Make sure dependenciesadded in build files.
Make sure you have EMUI 11.0 and later versions.
Conclusion
In this article, we have learnt integration of Huawei HEM sdk. Also we learnt how to activate and deactivate an MDM license. HEM kit enables you to flexibly adapt your app to a wide range of device deployment scenarios for enterprises, to implement auto-deployment when they enroll a bunch of devices out of the box. This, in turn, dramatically reduces the required manual workload.
References
HEM Kit: https://developer.huawei.com/consumer/en/hms/huawei-hemkit/
Original Source

Beginner: Find Nearby ATMS with integration of Huawei Site Kit in Banking app (Kotlin)

{
"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"
}
Introduction
In this article, I will be integrating Huawei Site Kit in an Application.
Site Kit
This kit is used for getting the places and near-by places on keyword search. HUAWEI Site Kit provide users with convenient and secure access to diverse, place-related services.
Use Case
The Site Kit will be used to find nearby ATMs in a Banking Application which can perform basic functions such as Enter Pin, Withdraw Money, Deposit Money and Check Balance.
Requirements
1. Any operating system (MacOS, Linux and Windows).
2. Must have a Huawei phone with HMS 4.0.2.300 or later.
3. Must have a laptop or desktop with Android Studio, Jdk 1.8, SDK platform 26 and Gradle 4.6 installed.
4. Minimum API Level 21 is required.
5. Required EMUI 9.0.0 and later version devices.
Integrate HMS Dependencies
1. First register as Huawei developer and complete identity verification in Huawei developers website, refer to register a Huawei ID.
2. Create a project in android studio, refer Creating an Android Studio Project.
3. Generate a SHA-256 certificate fingerprint.
4. To generate SHA-256 certificate fingerprint. Choose View > Tool Windows > Gradle > Signingreport > SHA256 code.
Or use cmd as explained in SHA256 CODE
5. Create an App in AppGallery Connect.
6. Download the agconnect-services.json file from App information, copy and paste in android Project under app directory, as follows.
7. Enter SHA-256 certificate fingerprint and click Save, as follows.
8. Click Manage APIs tab and enable Site Kit.
9. Add the below maven URL in build.gradle(Project) file under the repositories of buildscript, dependencies and allprojects, refer Add Configuration.
Code:
maven { url 'http://developer.huawei.com/repo/' }
classpath 'com.huawei.agconnect:agcp:1.6.0.300'
10. Add the below plugin and dependencies in build.gradle(Module) file.
Code:
apply plugin: 'com.huawei.agconnect'
// Huawei AGC
Code:
implementation 'com.huawei.agconnect:agconnect-core:1.6.0.300'
// Site Kit
Code:
implementation 'com.huawei.hms:site:5.2.0.300'
11. Now Sync the gradle.
12. Add the required permission to the Manifestfile.xml file.
Code:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!--check wifi state-->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Development
activity_main.xml
XML:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:context=".MainActivity"
android:id="@+id/activity_main"
android:background="@color/purple_200">
<Button
android:id="@+id/btTrans"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="90dp"
android:layout_marginTop="100dp"
android:text="@string/click_to_start_transaction"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:layout_editor_absoluteY="327dp" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="70dp"
android:layout_marginTop="10dp"
android:text="@string/welcome_to_world_s_best_bank"
android:textSize="20dp" />
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="@drawable/hello" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="570dp"
android:layout_marginStart="120dp"
android:text="@string/find_atm"
android:textSize="18sp"
android:textStyle="bold"
android:visibility="visible" />
<EditText
android:id="@+id/search_query"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:hint="@string/search_atm_here"
android:inputType="text"
android:padding="5dp"
android:layout_marginTop="530dp"/>
<Button
android:id="@+id/button_text_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="220dp"
android:layout_marginStart="60dp"
android:text="@string/search"
android:textAllCaps="false" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#D3D3D3"
android:gravity="center_vertical"
android:padding="5dp"
android:text="@string/result"
android:textSize="16sp"
android:layout_marginTop="600dp"/>
<TextView
android:id="@+id/response"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:layout_marginTop="640dp"
/>
</FrameLayout>
MainActivity.kt
Code:
class MainActivity : AppCompatActivity() {
private var searchService: SearchService? = null
private var resultTextView: TextView? = null
private var queryInput: EditText? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
try {
searchService = SearchServiceFactory.create(
this,
URLEncoder.encode(
"CgB6e3x9Z0Sl/zgHigt2p775VippBazEDe6ujGs/R7iLuwd4Sum+m6aBgecx+gWQtkuVJu/BOp1UeLktd9cyuf66",
"utf-8"
)
)
} catch (e: UnsupportedEncodingException) {
Log.e("MainActivity", "encode apikey error")
}
queryInput = findViewById(R.id.search_query)
resultTextView = findViewById(R.id.response)
}
fun search(view: View?) {
val textSearchRequest = TextSearchRequest()
textSearchRequest.setQuery(queryInput!!.text.toString())
textSearchRequest.setHwPoiType(HwLocationType.TOWER)
searchService.textSearch(
textSearchRequest,
object : SearchResultListener<TextSearchResponse?>() {
fun onSearchResult(textSearchResponse: TextSearchResponse?) {
val response = StringBuilder("\n")
response.append("success\n")
var count = 1
var addressDetail: AddressDetail
if (null != textSearchResponse) {
if (null != textSearchResponse.getSites()) {
for (site in textSearchResponse.getSites()) {
addressDetail = site.getAddress()
response
.append(
String.format(
"[%s] name: %s, formatAddress: %s, country: %s, countryCode: %s \r\n",
"" + count++, site.getName(), site.getFormatAddress(),
if (addressDetail == null) "" else addressDetail.getCountry(),
if (addressDetail == null) "" else addressDetail.getCountryCode()
)
)
}
} else {
response.append("textSearchResponse.getSites() is null!")
}
} else {
response.append("textSearchResponse is null!")
}
Log.d("MainActivity", "search result is : $response")
resultTextView!!.text = response.toString()
}
fun onSearchError(searchStatus: SearchStatus) {
Log.e("MainActivity", "onSearchError is: " + searchStatus.getErrorCode())
}
})
}
}
Cloud Debugging
Use Cloud Debugging in HMS Toolkit to debug the app on a real device.
To use Cloud Debugging, you need to sign in using a HUAWEI ID, complete identity verification, and then authorize the sign-in.
Choose HMS > CloudDebugging.
You can use Available Devices. Select a device and click RUN.
Result
Tips and Tricks
1. Set minSDK version to 24 or later, otherwise you will get AndriodManifest merge issue.
2. Make sure you have added the agconnect-services.json file to app folder.
3. Make sure you have added SHA-256 fingerprint without fail.
4. Make sure all the dependencies are added properly.
Conclusion
In this article, we have learnt integration of Site Kit in Banking application. It will guide you to show nearby ATM based on the user input.
Reference
Site Kit: Documentation

Categories

Resources