{
"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"
}
Hi everyone
We need to debug while working on Android applications, include the necessary libraries in the project, follow the documentation and many more. Although it is possible to do these manually, a much more useful solution is now possible, “HMS Core Toolkit”.
What is HMS Core Toolkit?
It is an Android Studio plugin that collects code pieces, additional libraries, auxiliary services during debug and testing that developers can need during the development of their applications, during HMS integration.
What are the Features of HMS Core Toolkit?
Guide to how to integrate HMS Core into an application created from scratch
Tools to automatically integrate dependencies into the application you are developing
Providing practical and fast development in your application with sample codes about kits
Integration to work with G + H or direct Huawei Core services within your application with GMS dependencies
Testing the application on pure HMS devices
Automatic testing of applications on pure HMS devices and monitoring these test outputs
Setup and Getting Started
Let’s start studying…
First, let’s start by downloading the plugin. There are 3 ways to get the Plugin,
The first one is to install via Android Studio market,
The second is to download and install the plugin directly from Huawei’s site,
Finally, compile it by obtaining the source code via github.
Installing on Android Studio:
In Android Studio -> File -> Settings -> Plugins, we search by typing “HMS Core Toolkit” in the search bar:
When we restart Android Studio after installing the plugin, we see that the “HMS” tab is coming.
Getting on Huawei Official Site:
From this address, we go to the HMS Core Toolkit page and say “download now”. I recommend downloading the most current version among:
After the download is complete,
Android Studio -> File -> Settings -> Plugins
Just select “Install plugin from Disk” section and show the location where you downloaded HMS Toolkit:
After the plugin is installed, the “HMS” tab should have appeared on the top:
Also, if you want to see the source code of the plugin and customize it for yourself, you can look at the details on the Github page, or you can compile and use it yourself.
Login
After downloading the plugin, you need to login to your Developer account to start using it:
When you see this page after logging in, you can start using the plugin:
Configuration Wizard
You can follow step by step how to create an application from scratch thanks to this panel, which was created with the HMS ecosystem, which has just been introduced and decided to develop applications:
Repository
This section, which allows you to select the kits you want to use in your application and integrate them into your application, simply select from the interface.
For example, after selecting “Account Kit” and apply, it can automatically see the necessary additions to the gradle file of the HMS Core resources at the project level added with build.gradle:
Coding Asistant
This feature, which contains details on how you can integrate and start using the kits you want to integrate in your application, you can integrate the kits without the need for documentation in your project.
Also, thanks to the “Scenario Description” tab in the last step, you can learn how to use many features in the commonly used related kit and how to integrate them into your application interactively.
With drag and drop feature, it is possible to transfer samples directly into the code:
Cloud Debugging
Cloud debugging is another feature provided by HMS Core Toolkit to test our applications on the device during the development process, we can test your application in pure-HMS devices in real time.
Cloud Testing
We have the opportunity to make 4 different tests of the applications we write automatically. These types are:
Compatibility Test
Stability Test
Performance Test
Consumption Test
After the test is completed, you can view the results and details using the results button next to it.
HMS Convertor
In fact, thanks to this feature of HMS Core Toolkit, which is the main purpose of development, it is possible to automatically detect GMS dependencies for many kits and turn them into a structure that you can use either directly to HMS services or to both HMS and GMS.
Here you may have to wait a bit depending on the size of your project:
We have 3 options:
Add HMS API (HMS API First): if there is both GMS and HMS on the device where the application is installed, a structure that will prefer HMS will be installed first.
Add HMS API (GMS API First): If there is both GMS and HMS on the device where the application is installed, a structure that will be preferred GMS will be established first.
To HMS API: If you choose this option, all GMS dependencies in your application will be removed and HMS kits and services will be integrated instead.
If you are not sure which service you choose, you can get more detailed information from this link.
The part of the code that can automatically convert comes as unchecked next to you to check it, showing you as follows, it is applied automatically when you give your confirmation after checking:
Some parts are not suitable for automatic conversion, so you are asked to check and convert them manually:
In order to see the automatic changes made by the plugin, double clicking on the relevant line presents you the changes it made in a new window in comparison:
If something goes wrong in your project and you want to go back to the previous version, all you have to do is select the “restore project” from the panel to show the location where you backed up:
Thanks to all these features, the fact that all documents and codes we need for HMS integration can be provided through a plug-in while developing is one of the factors that increase comfort during development.
For questions and problems, you can reach us via [email protected] or Huawei developer forum.
Hope to see you in my next post ?
Thanks to Sezer Yavuzer Bozkır for this article
Original post: https://medium.com/huawei-developer...wiss-army-knife-hms-core-toolkit-da0dc5afa018
Related
More articles like this, you can visit HUAWEI Developer Forum
HUAWEI Analytics Kit 5.0 version has been updated, and it supports iOS SDK now, enabling one-stop, unified analysis of cross-platform Android and iOS users. It looks into user-centric analysis and helps you understand user behavior on the Android and iOS platforms. Today I want to share with you how to add Analytics Kit to your iOS App. The version I integrated is 5.0.0.300.
The general steps we will walk through include:
Configuring App Information in AppGallery Connect
Integrating the HMS Core SDK
Accessing HUAWEI Analytics Kit
Configuring App Information in AppGallery Connect
Follow the steps below to configure App Information in AppGallery Connect for your iOS application. If you have both an Android and an iOS version of your app, you can set them within the same project, this will allow you to finish the data analysis conveniently.
{
"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"
}
Getting Started:
1. Have your Bundle ID ready for your iOS app (ask your developers for this).
2. Go to AppGallery Connect and create a new project.
Once you’ve created a new project, you’ll see a page, and the side navigation bar shows the AGC's various function menus.
3. Click Add app, and create an iOS application.
Here the App package ID is the Bundle ID.
Click OK, and then you will get the configuration file agconnect-services.plist.
Click Manage APIs, and here we’ve already had the Analytics API enabled.
Back to the side navigation bar, and go to the HUAWEI Analytics tab, you will see all kinds of functions, including User analysis, Behavior analysis, etc. Select any menu to Enable Analytics service.
On the Project access settings page, set the data storage location, time zone, currency, user data storage time, and calendar week, and click Finish.
Integrating the HMS Core SDK (in Cocoapods Mode)
I prefer the Cocoapods Mode. You can also integrate the HMS Core SDK into the Xcode Project Manually.
1. Add the AppGallery Connect configuration file of the app to your XCode project.
a. Click Download agconnect-services.plist to obtain your iOS config file (agconnect-services.plist).
b. Move your agconnect-services.plist file into the root of your Xcode project.
2. Edit the Podfile file
a. Create a Podfile if you don't already have one:
$ cd your-project-directory
$ pod init
b. To your Podfile, add the pods that you want to use in your app: Add pod 'HiAnalytics', that is, the dependency for pod.
Example Podfile file:
Code:
# Uncomment the next line to define a global platform for your project
# platform :iOS, '9.0'
target 'HiAnalyticsSwiftDemo' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for HiAnalyticsSwiftDemo
pod 'HiAnalytics'
target 'HiAnalyticsSwiftDemoUITests' do
# Pods for testing
end
end
c. Install the pods, then open your .xcworkspace file to see the project in Xcode:
$ pod install
$ open your-project.xcworkspace
Accessing HUAWEI Analytics Kit
1. Initialize Analytics SDK in your app
The final step is to add initialization code to your application. Initialize AppDelegate through the config interface.
Objective C sample code: Perform initialization in AppDelegate.m.
Code:
#import "AppDelegate.h"
#import <HiAnalytics/HiAnalytics.h>
@interface AppDelegate ()
@end
@implementation AppDelegate
...
- (BOOL)Application:(UIApplication *)Application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after Application launch.
[HiAnalytics config];//Initialization
return YES;
}
...
@end
Swift code example: Perform initialization in AppDelegate.swift.
Code:
import UIKit
import HiAnalytics
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
...
func Application(_ Application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after Application launch.
HiAnalytics.config();//Initialization
return true
}
...
}
2. Record defined events using the onEvent API.
For definitions of the events, please refer to Event Description.
3. Call APIs of HUAWEI Analytics Kit to implement the corresponding functions. For details, please refer to API Reference.
During the development, you can use DebugView to view the event records in real time, observe the results, and adjust the event tracing scheme.
Enabling/Disabling the Debug Mode
1.To enable the debug mode:
Go to Product > Scheme > Edit Scheme from the Xcode menu. On the Arguments page, click + to add the -HADebugEnabled parameter. After the parameter is added, click Close to save the setting.
Code:
1. –HADebugEnabled
2.To disable the debug mode
Code:
1. -HADebugDisabled
After the data is successfully reported, you can go to HUAWEI App Debugging to view the data, as shown in the following figure.
Q&A:
1. I have integrated the iOS SDK of HUAWEI Analytics Kit into my app but why no log events are collected when the app is running?
When this problem occurs, it is probable that the run log parameters have not been set. You can set the log level to any of the following values: -HALogLevelDebug, -HALogLevelInfo, -HALogLevelWarn, and -HALogLevelError.
For example, to set the log level to -HALogLevelDebug, perform the following steps:
Choose Product > Scheme > Edit Scheme from the Xcode menu.
On the Arguments page, click + to add the -HALogLevelDebug parameter.
After the parameter is added, click Close to save the setting.
Face problems during development? Take it easy. Go to Stack Overflow and raise your questions. Huawei experts will get back to you as soon as possible.
https://stackoverflow.com/questions/tagged/huawei-mobile-services?tab=Newest
We've introduced how to integrate AppGallery Connect Crash to an Android app. The integration procedure for an iOS app is similar. Let's take a look. you can also download the codelab to integrate.
Creating Your Project and App
First, you need to create a project in AppGallery Connect and add an app to it. For details, see the AppGallery Connect documentation.
Enabling HUAWEI Analytics
The Crash service uses capabilities of HUAWEI Analytics when reporting crash events. Therefore, you must enable HUAWEI Analytics before integrating the Crash SDK. For details, please refer to the AppGallery Connect documentation.
Integrating SDKs
If you are using Xcode, you can integrate the Crash SDK into your Xcode project with CocoaPods.
1. Sign in to AppGallery Connect and click My projects.
2. Find the project you created from the project list, and click the app for integration on the project card.
3. Go to Project Settings > General information, and click agconnect-services.plist under App information to download the configuration file.
{
"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"
}
4. Add the agconnect-services.plist file to the Xcode project directory.
5. Create a Podfile.
Open the CLI and navigate to the location of the Xcode project. Then, create a Podfile. Skip this step if a Podfile already exists.
HTML:
cd project-directory
pod init
6. Edit the Podfile.
1) Integrate the Analytics SDK and the Crash SDK.
Edit the Podfile to add pod dependencies of HUAWEI Analytics and the Crash SDK.
HTML:
target 'demo' do
# Pods for demo
pod 'HiAnalytics'
pod 'AGConnectCrash'
end
end
2) Install the pod and open the*.xcworkspace file to view the project.
pod install
7. Initialize the AppGallery Connect SDK and Analytics SDK.
HTML:
Import header files to the AppDelegate.m file of the project and add code for initialization.
#import "AppDelegate.h"
#import <AGConnectCore/AGConnectCore.h>
#import <HiAnalytics/HiAnalytics.h>
[user=2052344]@impl[/user]ementation AppDelegate
- (BOOL)Application:(UIApplication *)Application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after Application launch.
[AGCInstance startup];// Initialization
[HiAnalytics config];// Initialization
return YES;
}
...
[user=994449]@End[/user]
Testing the Crash Service
Create a test button makecrash in your demo project, and tap the button to trigger a crash. You can drag and drop the button for creating it, which is simple. The result is as follows.
Call the testIt method provided by AppGallery Connect to trigger a crash.
In your Xcode simulator, install and run your app, and tap the makecrash button to trigger a crash.
Viewing a Crash Report
1. Sign in to AppGallery Connect, go to My projects, and find the app in which you triggered the crash.
2. Go to Quality > Crash. On the Crash page, click the Statistics tab to view crash statistics of your app. The crash information is displayed just 1 or 2 minutes after you run your app.
3. Click the Problems tab to view the crash of your app. For example, in the following figure, NSRangeException is the crash triggered during the test.
Click the crash to view its details.
Summary:
1、It is easy to integrate the Crash service. During testing, you can either write code yourself, or use the testIt method provided by AppGallery Connect.
2、Crash reports are available in only 1 or 2 minutes.
3、 All you need to write is just a few lines of code during testing. The service integration for app release is coding-free.
4、 The Crash service also provides features including restoring obfuscated reports and generating custom reports.
Reference documents
HUAWEI AppGallery Connect Crash documentation: https://developer.huawei.com/consum...Gallery-connect-Guides/agc-crash-introduction
Coding-free Integration of AppGallery Connect Crash into an Android App:
https://developer.huawei.com/consumer/en/forum/topic/0201387764119030047?fid=0101271690375130218
Codelab of Crash in iOS:
https://developer.huawei.com/consumer/en/codelab/CrashService-iOS/index.html#0
How much time it took to get reports on AGC console ?
sanghati said:
How much time it took to get reports on AGC console ?
Click to expand...
Click to collapse
It takes 3 to 5 minutes to generate a visualized report.
Wow, thank you for such a useful article. This information really helped me! I am not very well versed in application development, so I often make various mistakes. When I needed to urgently create an application for my project, I was looking for a service that could help me with this. It was very difficult to find a really cool service that could create exactly what I want. On the advice of my friend, I turned to www.cubycode.com and it was a real salvation for me. They did everything exactly as I wanted! Now I try to learn everything related to application development, as it will be very difficult for me without this skill. Thanks to posts like this, I was able to extract a lot of useful information and make fewer mistakes. Thanks!
It can be useful.
Ciceniss said:
Wow, thank you for such a useful article. This information really helped me! I am not very well versed in application development, so I often make various mistakes. When I needed to urgently create an application for my project, I was looking for a service that could help me with this. It was very difficult to find a really cool service that could create exactly what I want. On the advice of my friend, I turned to www.cubycode.com and it was a real salvation for me. They did everything exactly as I wanted! Now I try to learn everything related to application development, as it will be very difficult for me without this skill. Thanks to posts like this, I was able to extract a lot of useful information and make fewer mistakes. Thanks!
Click to expand...
Click to collapse
Thank you for your like. And crash service can reporting non-fatal exceptions now. you can try it to handle your mistake.
Rebis said:
It can be useful.
Click to expand...
Click to collapse
Thank you for your love. I hope you pay attention to my follow-up content.
Hi everyone,
In this article, we will convert a GMS project which has Location, Map and Analytics APIs to GMS+HMS project step by step. In order to do that, I prepared an initial project which has those APIs for you to download.
You can find and download the GitHub link of the initial project in this link. This project contains the main features of the Google Location, Map, Analytics APIs. We will install HMS toolkit plugin to Android Studio, configure the project with App Gallery Connect, and finally convert it step by step.
Installing the HMS toolkit plugin
We start by installing the HMS toolkit plugin in Android Studio. For this in the Android Studio window, you should open settings by navigating File -> Settings. In the marketplace, search for HMS toolkit and install the plugin.
{
"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"
}
After installing the HMS toolkit, you will be prompt that you need to restart Android Studio. Follow the instruction and restart the IDE. After restarting the IDE, you will see the HMS section in the toolbar of Andriod Studio.
Running the initial project
As it is mentioned before, the initial project has Google Location, Map and Analytics APIs. When you run the project in a GMS device, it should look like this;
As you can see in the figure, there are three activities which are for Map, Location and Analytics APIs. This initial project only works on devices with Google Mobile Services. Next step is configuring our project with Huawei Mobile Services.
Creating a New Project in AppGallery Connect
The first thing we are going to do is creating a project through the AppGallery Connect platform. Go to this link and create a developer account. Then go to the console by clicking the console button at the left top corner in the web page. Click on , then click on “My Apps”. Afterwards, you will need to create a new app by clicking the “New App” button at the left top corner. Fill the necessary parts accordingly.
After creating the app, we are going to configure our project in the AppGallery Connect. In order to do that, at the navigation window near the AppGallery Connect logo, click “My projects” section.
The project page will ask us to fill the package name section. This will also help our toolkit to automatically match between the Android Studio and AppGallery Connect.
After configuring the package name, in the “Project Settings” page, you should set your Data Storage location.
Also, we are gonna activate the APIs that we are going to convert from Google Mobile Services by opening the “Manage APIs” page. In our case, we need to activate Location Kit, Analytics Kit and Map Kit. In order to activate the Analytics kit, you should enable Analytics Kit at the “Project Overview”, in the HUAWEI Analytics section which is shown in the navigation bar on the left.
For creating a new app on AppGallery Connect, please refer to the official documentation.
Configuring the Project Using HMS toolkit- Configuration Wizard
Now we can continue to configure our project with HMS toolkit in Android Studio. When you click the HMS section, you will see the window which you can use the features of the HMS toolkit. In this article, we will use Configuration Wizard and Convertor.
We are going to use Configuration Wizard in order to configure our project, connect the project with App Gallery Connect, create a keystore.jks file, download the related agconnect-services.json file and configure the related APIs for the project.
In order to configure our project, we will need to set the fingerprint of our project. We are going to choose “Use your certificate” option and create a new fingerprint for our project as seen in the figure below.
After creating fingerprint and starting the configuration process, the configuration wizard will start analyzing and configuring our project. It will match the Android Studio project with the AppGallery project, download necessary settings, service files and configure the fingerprint in the project.
Converting the project with HMS toolkit convertor
We configured our project successfully. Next, we are going to convert our project. We will start the conversion process by selecting Convertor -> New Conversion.
Follow the conversion procedure as shown below. Select a backup directory to prevent any unexpected errors. By doing this, you will be able to restore your project to the version before the conversion
In this part, you will see the analysis of automatic conversion rate. In our case, we have a %100 auto conversion rate and we will not have to convert anything manually. Since we are going to convert our project to GMS+HMS project, we are going to select the conversion policy as “Add HMS API(HMS API First)” then we will click “Analyze” button.
After the analysis is finished, we will have an analysis report as seen in the figure below. As we can see, there are auto conversion entries as well as manual conversion. In order to solve those manual conversion entries, we are going to click “Details” in the corresponding entry and follow the procedures. In order to start the automatic conversion, we are going to select all the automatic conversion entries and click the convert button.
Auto: This item will be automatically converted.
Dummy: HMS does not support this method. The XMS Adapter encapsulates only the GMS method. You need to confirm whether to retain or delete this method in or from HMS. After the confirmation, you can start an automatic conversion.
Manual: This item requires manual conversion.
Since we selected G+H conversion, convertor added the XMS Adapter to the project, an adaption-layer code module, based on the original code for calling third-party APIs. The adapter code can call GMS APIs or HMS APIs based on the scheduling policy. The scheduling policy is determined by us. In this project, we selected the policy of “HMS APIs first”.
The XMS Adapter automatically generated by the tool schedules GMS APIs and HMS APIs and separates or decouples service code from adapter code. You only need to pay attention to services and do not need to spend much time on the differences between GMS APIs and HMS APIs.
For details about the principle, please refer to Add HMS API Policy.
After the conversion, we are synchronizing the build.gradle files and check the project whether we have any errors. Because we are developing this project in Kotlin, we encountered some getter setter errors.
In order to fix those errors, we will change the getter setter functions as we are doing in Java.
Testing the converted project with both GMS and HMS devices
After we fix all the errors in the project, now we are ready to run the project both in the GMS device and the HMS device. As it is seen in the figures below, the application is working on the HMS only device. If we run it on the GMS only devices, it will also work without any problem.
If we also check the App Debugging section of HUAWEI Analytics in the AppGallery Connect Platform, it will be seen that the Analytics kit is also working exactly how it should.
Conclusion
Migrating a complex project from GMS to HMS is very easy with HMS toolkit conversion. Thanks to XMSAdapter architecture that HMS toolkit provides, the application chooses GMS APIs or HMS APIs according to the availability of the services.
Please also refer to the official documentation of HMS toolkit: link
You can also find and download the fully converted version of the project here.
Any questions about the process, you can ask a question in https://forums.developer.huawei.com/forumPortal/en/home
Do we have something like Firebase UI in this plugin ?
Freemind R said:
Migrating a complex project from GMS to HMS is very easy with HMS toolkit conversion.
Click to expand...
Click to collapse
Yeah right. I just tried the converter tool on a complex project and in the generated code I see tons of
Code:
XMS does not provide this api
and
Code:
throw new java.lang.RuntimeException("Not Supported");
There are more that 100 such occurrences in the code. Also converter skips lot of things in the code base which need to be converted manually.
Also it doesn't detect some of google apis at all (places sdk).
Also it generates tons of gradle modules and flavors for no reason, so building a project takes forever.
So basically this converter tool is a garbage. Don't waste your time.
Environment for Game Release and Testing
1. Have a Huawei mobile phone ready.
2. Connect that mobile phone to a PC using a data cable, and make sure that it remains connected during the game release.
The reason is that a Huawei quick game will not generate a QR code for release, so the data cable is needed during the release process. Otherwise, only one RPK package will be generated during game release in the LayaAir IDE, and you still need to connect the two devices and copy the RPK package to the mobile phone.
3. Install Node.js 10.x. You can download it here: https://nodejs.org/download/release/latest-v10.x/.
4. Install the LayaAir 2.8.1 IDE, or a later version. You can download it here: https://ldc2.layabox.com/layadownload/?type=layaairide.
Preparations
To ensure that your game release goes as smoothly as possible, make sure that you:
1. Have installed Node.js and LayaAir IDE on your PC. You do not need to install the ADB and OpenSSL, as they are built into the LayaAir IDE.
2. Have enabled the developer mode on your mobile phone, and allowed for USB debugging.
{
"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"
}
If you do not know how to enable the developer mode, you can check Huawei’s documentation at https://developer.huawei.com/consumer/en/doc/quickapp-open-developer-option.
Releasing a Huawei Quick Game in the LayaAir IDE
First, use the release function for the LayaAir IDE to package the Huawei quick game project to an RPK file. Then, open this project in the IDE and go to Project > Release. Select the release platform huawei fast game and set Minimum platform version(1075). Lastly, click publish to release your quick game.
I won’t describe the steps required for release in detail here. If you have any questions, please refer to the official website.
About the Certificate Fingerprint
If the release signature has been generated in the project, you can print the signing certificate fingerprint on the release page. This fingerprint will be used when you submit a Huawei quick game.
It’s important to note that the print button is only available after the release signature is generated. If no signature is generated, the message shown in the following figure will be displayed, indicating that the certificate does not exist.
Running and Testing the Game on a Real Device
After the game has been successfully released on LayaAir IDE, it will automatically run on the Huawei phone in full-screen mode. If you exit the game, you can also launch the Huawei Quick App Loader and tap the game name to restart the game.
Debugging the Game
No tool is available for debugging a Huawei quick game, so you’ll need to make sure that your browser supports the HTML5 version of the game. Debugging your Huawei quick game requires that you check its logs, so you’ll need to retain the default value log for the log level in LayaAir IDE, as shown in the figure below. In this case, both the LayaAir IDE logs and error logs will be recorded. If you set the log level to error, only error logs will be recorded. Both options allow you to view logs after the game’s release. If you select off, no logs will be available.
You can directly view logs on the project release page, as shown below.
You can also open another CLI on your PC to view logs by entering the following command. This method enables you to avoid keeping the IDE open for debugging for a long period.
adb logcat -s jsLog
All logs generated during runtime after the release are displayed in the CLI, as shown below.
If you would like to export logs, please use Huawei Quick App PC Assistant.
FAQs
1. Do Huawei quick games support package splitting?
Splitting the package of a Huawei quick game and loading its subpackages helps reduce the traffic and time required for app downloads. When doing so, you can choose to load or download specific subpackages, rather than the entire package.
Before using this method, you’ll need to determine whether this method is necessary for your project. Most quick game packages are small enough that they do not necessarily require splitting. You can opt to:
(1) Delete unnecessary JavaScript code.
If the package is not split, the JavaScript files referenced in the index.js and HTML files are packaged in the last RPK file, unless these JavaScript files are referenced elsewhere in the project. You can also directly delete the unused JavaScript files, for example, those of unused engine libraries and third-party class libraries, to reduce the package size.
(2) Compress and obfuscate JavaScript files.
This can significantly reduce the file size. If the file size does not exceed 4 MB, you won’t need to split the package, as game content can be dynamically loaded through URLs. After the content is loaded for the first time, it is stored in the physical cache. Common content that occupies less than 50 MB will not be reloaded the next time.
2. When a third-party library, for example, protobuf, is introduced, the gameThirdScriptError error is reported. What should I do?
A potential cause is that the library contains such code as Function(“return this”)();. For security purposes, the game engine disables such code by default. It is recommended that you modify the JavaScript code. In addition to protobuf, the following third-party libraries have similar code. If these libraries need to be introduced, you’ll need to modify the code as well.
If you do not modify the code, you’ll need to enable the runGame parameter, which is not recommended.
For more information, please refer to:
Huawei Quick App PC Assistant materials:
https://developer.huawei.com/consum...ickApp-Guides/quickapp-pcassistant-user-guide
Huawei quick game materials:
https://developer.huawei.com/consum...uickApp-Guides/quickgame-develop-runtime-game
Huawei's In-App Purchases (IAP) service allows you to offer in-app purchases and facilitates in-app payment. Users can purchase a variety of virtual products, including consumables and non-consumables.
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 Dependenciesl The SDK of the latest version can be used only on devices running HMS Core (APK) 4.0.0.300 or later. If a user is using a device without HMS Core (APK) 4.0.0.300 or later, the user will be directed to install it when it is called by your app. User devices need to run EMUI 3.0 or later or Android 4.4 or later (API level 19 or later). The Unity version must be 2018.4.25 or later.
1.2 Preparations1.2.1 Importing Unity Assets1. Open Asset Store in Unity.
Go to Window > Asset Store in Unity.
2. Search for and import the Unity Distribution Portal (UDP) asset in Asset Store. For information about UDP, please visit https://docs.unity3d.com/Packages/[email protected]/manual/index.html.
1.2.2 App DevelopmentConfigure product information based on the sample, and then use the sample for test.
1.2.2.1 Uploading Your Project to UDP1. Go to Window > Unity Distribution Portal > Settings in Unity and click Go to the Services Window.
2. Select an organization.
3. linked your project to a UDP client
Go to Window > Unity Distribution Portal > Settings > Inspector in Unity and click Generate new UDP client.
4. Set Game Title and UDP Sandbox Test Accounts.
1.2.2.2 Configuring Product Information in Your Unity ProjectGo to Window > Unity Distribution Portal > Settings > Inspector > IAP Catalog.
After product information is configured, click Push to synchronize the information to UDP.
1.2.2.3 Creating an App and Configuring Product Information in AppGallery Connect1.2.2.3.1 Creating an AppCreate an app by following instructions in Creating an AppGallery Connect Project and Adding an App to the Project. The package name of the game for AppGalleryKit must end with .HUAWEI or .huawei. Otherwise, the game will be rejected.
1.2.2.3.2 Configuring Product Information1. Sign in to AppGallery Connect and click My projects. Select your project, enable In-App Purchases, and obtain the public key.
2. Sign in to AppGallery Connect and click My apps.
3. Click an app from the app list to add a product.
1. Go to Operate > Products > Product Management and click Add Product.
2. Configure product information, which must be the same as that configured in Unity.
3. Activate the product.
1.2.2.4 Configuring the Unity Project Package NameGo to Edit > Project Settings > Player, click the Android icon, and go to Other Settings.
Note: Ensure that the package name configured here must be the same as that in AppGallery Connect. All package names in AppGallery Connect must end with .huawei. If the package name in Unity does not end with .huawei, the UDP console will supplement it during repacking for name consistency.
1.2.2.5 Configuring Product Information in GameManager1. Drag UDPSampleScene to the top.
2. Enter the configured product ID in GameManger.
3. Push all configurations.
1.2.3 Testing the APK1. Go to File > Build Settings > Android in Unity and click Switch Platform.
1.1 Select UDP/Sample/UDPSampleScene.
1.2 Build the project. Save and install the APK.
2. Use the configured sandbox test account to initialize the APK.
2.1 Open the APK and tap Init.
2.2 Enter the configured sandbox account.
3. Initialize the sandbox test.
4. Tap the Buy button to test the product purchase function.
Verify that the sandbox test is complete.
1.2.4 Repacking the APK1. Sign in to the UDP console.
2. Click the newly created game.
3. Edit the game information and then click Release.
4. Choose HUAWEI AppGallery.
5. Unity will automatically find the project info that has same package name in AGC, Set your IAP public Key manually
6. Choose HUAWEI AppGallery and click Publish.
7. The UDP console repacks your APK.
8. Download the repacked APK, which supports payment by IAP.
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