Coding-free Integration of AppGallery Connect Crash into an iOS App - Huawei Developers

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.

Related

【Trip to HMS Core 5.0】Add Analytics Kit to Your iOS App

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

Mobile Developer’s Swiss Army Knife: HMS Core Toolkit

{
"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

Easy and Quick Way to Migrate a GMS Project to HMS Environment - G+H Solution: HMS Toolkit Convertor

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.

Coding-free Integration of AppGallery Connect Crash into a Cocos-based App

The Crash service of AppGallery Connect provides a simple, coding-free solution for app crashes. It is found that Cocos Creator also supports the Crash service provided by AppGallery Connect. Let’s see how it works.If you want to quickly experience this service, see the demo on GitHub.
1. Creating an App and Enabling the Crash Service
1.1 Setting a Cocos App ID
Cocos app ID is the unique identifier of a game app. Before using services, you need to set a Cocos app ID for your game project.
If you do not have a Cocos-based game, click Dashboard to create one in the Cocos Account Center, as shown in the following figure.
{
"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"
}
In the Cocos Account Center, click Create a game, complete your game information, and obtain the generated app ID.
Return to Cocos Creator, click Set Cocos AppID, and choose the game to associate it.
1.2 Enabling HUAWEI Analytics and Crash in Cocos Creator
In the Service panel, enable HUAWEI Analytics and Crash.
You can also view the enabled services (highlighted) in the Cocos Account Center, as shown in the following figure.
1.3 Enabling HUAWEI Analytics and Crash in AppGallery Connect
You also need to enable the services in AppGallery Connect. The steps are as follows:
a) Sign in to AppGallery Connect, create a project, and add an app to it. For details about how to create an app in AppGallery Connect, check the official documentation.
b) In AppGallery Connect, click My projects, select a project, go to Quality > Crash, and click Enable now to enable both HUAWEI Analytics and Crash.
c) Go to Project settings and download the latest agconnect-services.json file.
d) Save the downloaded agconnect-services.json file to the settings directory in your Cocos project.
The file is also displayed in Cocos Creator, as shown in the following figure.
2. Building and Installing an App
2.1 Releasing your app in AppGallery Connect
a) In Cocos Creator, go to Project > Build…, choose HUAWEI AppGallery Connect, and set a package name. The package name must be the same as that configured in AppGallery Connect. Otherwise, a compilation error will be reported.
b) Click Build, and then Compile. You can find the corresponding APK file in the \build\jsb-link\publish\android directory of the project. You can run the adb command after a USB cable has been connected to install the package on your phone for testing.
c) You can also upload the APK file to AppGallery Connect by clicking Upload next to Compile. Select a sign-in type, fill in the relevant information, and click Confirm.
2.2 Releasing your app to an Android platform
a) In the Build… panel, choose Android for Platform, connect a phone to your computer, and click Play to install the APK file to your phone.
b) You can also open the project in the \build\jsb-link\frameworks\runtime-src\proj.android-studio directory in Android Studio.
3. Testing the Crash Service
Usually, app crashes are not common. You can manually trigger a crash and test the Crash service by calling the AGConnectCrash.testIt method of the Crash SDK and then checking whether the crash data is reported in AppGallery Connect.
In this example, a test button CrashTest is created. You can click the button to trigger a crash. The API is defined as follows:
testIt(): void
Sample code:
huawei.agc.crash.CrashService.testIt();
4. Viewing a Crash Report
4.1 Viewing crash statistics
a) Package and run your app. Tap CrashTest to trigger a crash. Exit the app and launch it again.
b) In AppGallery Connect, click My projects.
c) Find your project from the project list and click your app on the project card.
d) Go to Quality > Crash. On the Crash page, click the Statistics tab and select Last hour to view crash statistics of your app.
4.2 Viewing crash stack details
Click the crash name to go to the crash details page. Click the Stack tab. The possible causes of the crash are displayed, helping you analyze the crash.
4.3 Obtaining a readable crash report
a) When ProGuard or DexGuard overrides class names, fields, and methods in code with unreadable code during building, you can obtain a de-obfuscation crash report from the obfuscation mapping file.
b) Find the obfuscation mapping file in the following directory in Android Studio and download the file.
c) On the Mapping file tab page in AppGallery Connect, click Upload.
d) It is found that the data is restored.
Summary
1. It is simple to integrate the Crash SDK into a Cocos-based app. You just need to create an app and enable HUAWEI Analytics and Crash.
2. If it is your first time integrating the SDK, you can use a demo app for testing.
3. In addition to Crash, some other Huawei services have started to support Cocos-based apps.
For more details, please check:
1. Cocos official documentation:
https://docs.cocos.com/creator/manual/en/cocos-service/agc-crash.html
2. HUAWEI AppGallery Connect Crash documentation:
https://developer.huawei.com/consum...Gallery-connect-Guides/agc-crash-introduction
3. HUAWEI AppGallery Connect Crash codelab:
https://github.com/AppGalleryConnect/agc-crash-codelab-java
4. Cocos Creator Integrates with AppGallery Connect APM — Releasing a Cocos-based App:
https://forums.developer.huawei.com/forumPortal/en/topic/0202382127496450426?fid=0101187876626530001
if you have any question, please refer to stackoverflow.

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

My app has recently needed to use cross-platform sharing links and fortunately App Linking in AppGallery Connect exactly meets my requirements.
Perform the following steps for service integration:
i. Create an app and enable App Linking for the app.
ii. Create a URL prefix.
iii. Integrate the App Linking SDK into the Xcode project.
iv. Create a link of App Linking.
v. 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.plist file, and save the file to the directory of your Xcode 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 uniqueness of your domain name.
3. Integrating the App Linking SDK into Your Xcode Project​1. Open the CLI and navigate to the location of the Xcode project.
2. Run the pod init command to create a Podfile.
3. Open the Podfile and add the pod on which the AppGallery Connect base SDK depends to the Podfile.
Code:
pod 'AGConnectCore'
pod 'AGConnectAppLinking'
4. Run the pod install command to install the pod.
5. Do as follows to initialize the AppGallery Connect SDK: Import the header file <AGConnectCore/AGConnectCore.h> to the AppDelegate.m file of the project,
and add the following code to the applicationUIApplication *)application didFinishLaunchingWithOptionsNSDictionary *)launchOptions method:
Code:
#import "AppDelegate.h"
#import <AGConnectCore/AGConnectCore.h>
@implementation AppDelegate
- (BOOL)Application:(UIApplication *)Application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions {
// Override point for customization after Application launch.
[AGCInstance startup];// Initialization
return YES;
}
4. Creating a Link of App Linking​You can create a link of App Linking in AppGallery Connect or call an API in your Xcode project.
4.1 Creating a Link of App Linking in AppGallery Connect​1. On the displayed App Linking service page, click the App Linking tab and create a link as prompted.
2. Complete default deep link configurations. Refer to the following example. Pay attention to the deep link configuration for Android.
3. Set Link behavior for Android to Open in app.
After the link is successfully created, you can then copy and use it.
4.2 Creating a Link Through Coding​1. In the following iOS UI layout, add three button controls to create and copy links and four label controls to display the created links.
2. Declare necessary parameters.
3. Create a link.
Here, the iOS deep link is set to agckit://android/detail.
The Android deep link is set to agckit://android/detail.
4. Copy the long link and short link.
Refer to the following example for copying links:
5. Receiving a Link​1. To generate an asset verification file for a domain name, set the team ID under Project settings in AppGallery Connect. (The team ID is the value of Membership — Team ID on the Apple developer website.)
2. After the configuration is complete, an asset verification file is automatically generated for the default domain name. You can view the file at https://your_applinking_url_prefix/apple-app-site-association.
3. Set a custom scheme.
4. To set the code for receiving links, open the AppDelegate.m file and add the handleAppLinking method to the system startup method to process received link events.
5. Check whether the received link is a link of App Linking and whether the app can process the link.
For a custom scheme link:
Call sharedInstance of App Linking in the application: openURL: options: method to obtain a singleton object, and call openDeepLinkURL of the object to process the received link.
6. Packaging and Testing​1. Verify the link creation.
Tap CreatLink. A long link and a short link are generated.
2. Verify the function of starting an app through a link.
Click CopyShortLink and copy the link to the browser. An app can be started when you access the link.
7. Summary​Integration is simple. The SDK is small, and links can be shared across Android and iOS. No adaptation is required on different platforms, thereby reducing the workload.
Operations personnel can create links in AppGallery Connect for app promotion, and you can write code in apps to create links in a very convenient process.
For more information, please refer to:
HUAWEI AppGallery Connect App Linking documentation: https://developer.huawei.com/consum...ry-connect-Guides/agc-applinking-introduction
Nice thread
Useful and simple.
Abo Hoor said:
Nice thread
Click to expand...
Click to collapse
Thank you for your liking.
Rebis said:
Useful and simple.
Click to expand...
Click to collapse
Thanks

Categories

Resources