FAQs Related to HMS Core Video Editor Kit - Huawei Developers

Question 1​
When my app accesses a material (such as a sticker) for a user, my app displays a message indicating that the access failed due to a network error and prompting the user to try again.
When my app uses an AI capability, the following information was displayed in my app's logs: errorCode:20124 errorMsg:Method not Allowed.
Solution
1. Check whether you have configured your app authentication information. If not, do so by following step 1 in the development guide.
2. Check whether you have enabled Video Editor Kit for your app. If not, enable the service either on HUAWEI Developers or in AppGallery Connect. After the service is enabled, due to factors such as network caches, it will take some time for the service to take effect for your app.
3. Check whether the signing certificate fingerprint in the Android Studio project code of your app is consistent with that configured in AppGallery Connect. If not, or you have not configured the fingerprint in the project code or AppGallery Connect, configure the fingerprint by following the instructions here. After you configure the fingerprint, due to factors such as network caches, it will take some time for the fingerprint to take effect for your app.
4. Check whether you have allocated the material in question.
5. Check whether you have applied for the AI capability you want.
If the problem persists, submit a ticket online (including your detailed logs and app ID) for troubleshooting.
Question 2​
After my app obtains a material column, the column name was either 101 or blank in my app.
Solution
1. Sign in to AppGallery Connect and select your desired project. In the navigation pane on the left, go to Grow > Video Editor Kit > App content operations > Column manager.
{
"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 Delete columns.
3. Click Initialize columns.
4. Uninstall and then install the app.
Question 3​
When my app uses the AI filter of the fundamental capability SDK, my app receives no callback, and the Logcat window in Android Studio displays the following information: E/HVEExclusiveFilter: Failed resolution of: Lcom/huawei/hms/videoeditor/ai/imageedit/AIImageEditAnalyzerSetting$Factory;.
Cause
You did not add the dependencies necessary for the AI filter capability.
Solution
Add the following dependencies on the AI filter capability:
Code:
// Dependencies on the AI filter capability.
implementation 'com.huawei.hms:video-editor-ai-common:1.9.0.300'
implementation 'com.huawei.hms:video-editor-ai-imageedit:1.3.0.300'
implementation 'com.huawei.hms:video-editor-ai-imageedit-model:1.3.0.300'
Click here for more details.
Question 4​
My app is integrated with the fundamental capability SDK. After a video asset was added to the corresponding lane, my app called getSize or getPosition but obtained a null value.
Cause
When the getSize or getPosition method is called, the calculation of the video position in the preview area is not completed.
Solution
After adding a video asset to the lane, call seekTimeLine of HuaweiVideoEditor to begin calculation of the video position in the preview area. Calling seekTimeLine is an asynchronous operation. In its callback, you can obtain or set the size and position of an asset.
Below is an example:
Code:
// Specify the position of an asset on the preview area before adding the asset.
HuaweiVideoEditor.setDisplay(videoContentLayout);
Click here for more details.
Code:
// Add a video asset to the video lane.
HVEVideoAsset mHveVideoAsset= hveVideoLane.appendVideoAsset(sourceFile.getAbsolutePath());
mEditor.seekTimeLine(0, new HuaweiVideoEditor.SeekCallback() {
@Override
public void onSeekFinished() {
Log.d(TAG, "onSeekFinished: size:" + mHveVideoAsset.getSize() + ", position: " + mHveVideoAsset.getPosition()); }
});
References​
HMS Core Video Editor Kit home page
Development Guide of HMS Core Video Editor Kit

Related

Online Food ordering app ([email protected]) | App Messaging | Analytics kit | JAVA Part-4

More information like this, you can visit HUAWEI Developer Forum​
Introduction
Online food ordering is process to deliver food from restaurants. In this article will do how to Integrate Analytics, App-Messaging in food applications.
Steps
1. Create App in Android.
2. Configure App in AGC.
3. Integrate the SDK in our new Android project.
4. Integrate the dependencies.
5. Sync project.
Analytics Module
Huawei Analytics will helps to understand how people using mobile application. Analytics model help you gain a deeper insight into your user, products and contents.
1. Collect and report custom events.
2. Set a maximum of 25 user attributes
3. Automate event collection and session calculation with predefined event ID’s and parameter.
Use Cases
1. Analyze user behaviour using both predefined and custom events.
2. Use audience building to tailor your marketing activity to your users’ behaviour and preferences.
3. Use dashboards and analytics to measure your marketing activity and identify areas to improve.
Function Restrictions
Device restrictions: The following automatically collected events of analytics kit depend on HMS Core (APK). Therefore, which are not supported on third-party devices where HMS Core is not installed including but not limited to Oppo, Vivo, Xiaomi, Samsung and Oneplus.
Event quantity restriction: Each app can analyze a maximum of 500 events.
Event parameter restrictions: You can define a maximum of 25 parameters for each event, and maximum of 100 event parameter for each app.
AGC Configuration
1. Create an app adding an app to the project.
2. Enable Analytics Choose My Projects> Huawei Analytics
{
"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"
}
3. Enable Analytics API Choose My Projects > Project settings > Manage APIs
Integration
Create Application in Android Studio.
App level gradle dependencies.
Code:
apply plugin: 'com.android.application'
apply plugin: 'com.huawei.agconnect'
Gradle dependencies
Code:
implementation 'com.huawei.hms:hianalytics:5.0.3.300'
Root level gradle dependencies
Code:
maven {url 'https://developer.huawei.com/repo/'}
classpath 'com.huawei.agconnect:agcp:1.3.1.300'
1. Create Instance for HiAnalyticsInstance in the onCreate method
Code:
HiAnalyticsTools.enableLog();
HiAnalyticsInstance instance = HiAnalytics.getInstance(this);
2. Create method for report an event.
Code:
private void reportevent() {
Bundle bundle = new Bundle();
bundle.putString("Name", signInResult.getUser().getDisplayName());
mInstance.onEvent("SIGNIN", bundle);
}
Output
App Messaging Module
Huawei App messaging is one of the power full tool to promote information to audience. This will help when you are trying to get more attention to your application. We can target active users to encourage them to use this app.
App Messaging allows to customize your messages visuals and the way they will be sent, and define events for triggering message sending to your users at the right moment.
Message Types
1. Pop-up Message: Title, body and contain an image, and up to two buttons.
2. Banner Message: Message is displayed on top of the screen, containing a thumbnail and the message title and body. user can tap the banner to access specified page.
3. Image: It contains only image. An image message can be a poster well designed to promote an activity. User can tap the image to access the activity details.
AGC Configuration
1. Enable App Messaging Api Choose My Projects > Project settings > Manage APIs
2. Enable App Messaging Choose My Projects > Growing > App Messaging Click Enable Now.
3. Click New button and enter the required information.
4. Enter required details, and then click Next button.
5. In Select Sending Target node, click New condition for matching target users.
Select conditions in Select drop-down, and then click Next
6. In Set Sending Time node, select Started and Ended drop-downs.
Select required options in Trigger event and Frequency limit, and then click Next
7. Once all the required information filled, and then click Save button
8. Navigate to Operation tab, and then click Test option to perform the App Messaging publishing
Integration
Gradle dependencies
Code:
implementation 'com.huawei.agconnect:agconnect-appmessaging:1.4.0.300'
1. Generate AAID, this AAID will help you to sending App-Messages.
Code:
private void generateAAID(){
HmsInstanceId inst = HmsInstanceId.getInstance(this);
Task<AAIDResult> idResult = inst.getAAID();
idResult.addOnSuccessListener(aaidResult -> Log.d("AAID", "getAAID success:" + aaidResult.getId() ))
.addOnFailureListener(e -> Log.d("AAID", "getAAID failure:" + e));
}
2. For displaying messages we need to call AGConnectAppMessaging Instance.
3. setFetchMessageEnable() To allow data synchronization from the app gallery connect server.
4. setDisplayEnable() To Enable message display.
5. setForceFetch() To specify that the in-app message data must be obtained from App Gallery connect server.
Code:
private void initializeInAppMessage(){
AGConnectAppMessaging appMessaging = AGConnectAppMessaging.getInstance();
appMessaging.setFetchMessageEnable(true);
appMessaging.setDisplayEnable(true);
appMessaging.setForceFetch();
}
Result:
Conclusion
In this Article, I have explained how to integrate App Messaging and Analytics Kit on food application.
Reference:
Analytics kit:
https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/introduction-0000001050745149
App Messaging:
https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-appmessage-introduction

Effortless integration of Analytics Kit in Unity

Overview
In this article, I will create a demo game and integrate Huawei Analytics Kit. A developer can keep keen eyes on application usages and easily track the events such as installation and other custom events.
Service Introduction
Analytics Kit collects a user’s activity and usage of an application so that developer can analyze the user’s behaviour based on the app event.
Analytics Kit offers a rich array of preset analytics models (Event, Behaviour, Audience, Funnel, Retention, Real-Time) that help you to gain an in-depth insight into your users, products, and content. With this insight, you can then take a data-driven approach to make informed decisions for product and marketing optimizations.
HUAWEI Analytics Kit identifies users and collects statistics on users by an anonymous application identifier (AAID). The AAID is reset in the following scenarios:
1) Uninstall or reinstall the app.
2) The user clears the app data.
After the AAID is reset, the user will be counted as a new user.
There are 3 types of events: Automatically collected, predefined, and custom.
Automatically collected events are collected from the moment you enable the kit in your code. Event IDs are already reserved by HUAWEI Analytics Kit and cannot be reused.
Predefined events include their own Event IDs which are predefined by the HMS Core Analytics SDK based on common application scenarios. The ID of a custom event cannot be the same as a predefined event’s ID. If so, you will create a predefined event instead of a custom event.
Custom events are the events that you can create for your own requirements.
Prerequisite
1. Unity Engine (Installed in the system)
2. Huawei phone
3. Visual Studio 2019
4. Android SDK & NDK (Build and Run)
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. Enable Analytics Kit from Manage APIs section.
Game Development
1. Create a new game in Unity.
2. Now add game components and let us start game development.
3. Download HMS Unity Plugin from below site.
https://github.com/EvilMindDevs/hms-unity-plugin/releases
4. Open Unity Engine and import the downloaded HMS Plugin.
Choose Assets > Import Package> Custom Package
5. Choose Huawei > App Gallery.
6. Provide the AppId and other details from agconnect-service.json file and click configure Manifest.
For more, you can check https://forums.developer.huawei.com/forumPortal/en/topic/0204447943331070086

Find Near & Around places based on your location: HMS Site, Location, Map Kit

r
{
"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"
}
​Hello, in this story I will give you an example of how to combine HMS Site, Location, and Map Kits. This application will allow you to display nearby restaurants, schools, shopping centers, etc. on the map based on your current location. First, will get the user’s location information with the Location kit. According to the location, we will search nearby places with one of the site kit’s features. Then we will display the received data on the map.
Get User's Location
First, you need to register as a Huawei Developer and complete the verification process. For detailed information please refer to the link below.
Register as a Developer
In AppGallery Connect console create a project and enable the Map, Site, and Location kits. You can follow the steps below:
AppGalleryConnect
To complete the implementation of kits we need to add dependencies on build.gradle file.
Last, add permissions on AndroidManifest.xml and we’re all set.
We need a permissionHandler class to manage location permissions.
In this app, I used the Android Navigation Component, that’s why all transactions will be in the MainFragment. To get user’s permission for location, call requestPermissions() method in onViewCreated(). We need 3 runtime permissions for location, so declare an array of permissions.
requestPermissions(PERMISSIONS, PERMISSION_ALL)
Create a FusedLocationProviderClient instance in onViewCreated() method :
Then call the getLastLocation() method right after instance. This method provides us user’s last known location. In most cases, the last known location is the current location of the device.
Now we have latitude and longitude information of the user’s device. Define two global double variables to hold lat and lng information. We will use these variables to get sites.
For nearby place parameters, set a string list in a spinner.
You can add more place options according to HMS Site kit HwLocationTypes below:
Location Kit
In onViewCreated method set an adapter for the spinner,
We will mark sites on the map according to the changed spinner item, first, we need to create a getSites() method to receive site information.
In this method, we request site data for the current location with the HwLocationType parameter that we received from the spinner onItemSelectedListener. And we marked each site location on the map with distance information. You can change NearbySearchRequest() parameters in your own way. For example, I set a radius of 5000 to get sites around 5K km from the user’s device location. But the only hwPoiType needs to be a dynamic value. Let’s set the dynamic value.
First, initialize map in onViewCreated method and extend OnMapReadyCallback.
Once you extend the map callback to the fragment, it asks you to add onMapReady method. In this method set the onItemSelected of the spinner.
Conclusion
So we get the user’s device's last known location, asked the user to choose a place to search for sites and we marked the received places on the map.
References
Demo Project
very detailed, thanks for sharing
i love it

Working with Wi-Fi Status of Device by using Awareness Kit

{
"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​With the help of Awareness Kit, we can have more details about the current situation of user’s device. Thus, we can develop more efficient applications and build different logics according to different situations.
Awareness Kit has many features for handling many different situations. If we briefly talk about its features, Awareness Kit has features such as Time Awareness, Location Awareness, Behavior Awareness, Beacon Awareness, Audio Device Status Awareness (Ambient Light Awareness, Weather Awareness) and Phone Status Awareness (Screen Status Awareness, Wi-Fi Status Awareness, Dark Mode Awareness, App Status Awareness).
In this article, I will only give examples about Wi-Fi Status Awareness feature. If you would like to learn more about other features, you can visit developer website to learn more details about them.
https://developer.huawei.com/consum...-Guides/service-introduction-0000001050031140
How to Integrate HMS Dependencies​First of all, we need to create an app on AppGallery Connect and add related details about HMS Core to our project.If you don’t know about how to integrate HMS Core to our project, you can learn all details from following Medium article.
https://medium.com/huawei-developers/android-integrating-your-apps-with-huawei-hms-core-1f1e2a090e98
When we have added our hms core dependencies and created an app on AGC, we can implement Awareness Kit dependency.To implement Awareness Kit to our app, we need to add the following dependency to our project.
implementation 'com.huawei.hms:awareness:{version}'
Currently, awareness kit version is 1.0.8.301
implementation 'com.huawei.hms:awareness:1.0.8.301'
Note: Don’t forget to enable Awareness Kit on AGC.
With Android 11, making query to other apps on the device and interacting with them has been changed. If our targetSdkVersion is 30 or later, we need to make some changes on AndroidManifest.xml file.
To make query to other apps from our app and interact with them, we need to add queries to AndroidManifest.xml file.
Note: To work with Awareness Kit, our minSdkVersion should be equal to or higher than 24.
Wi-Fi Status Awareness​With Wi-Fi Status Awareness, we can detect the Wi-Fi status of the device or we can listen Wi-Fi status changes of the device.
There are two different ways to work with Awareness. Let’s examine them:
Capture: With the Capture API, we can obtain the current situation of Wi-Fi status. For example, when user has clicked the button, we can check the Wi-Fi status of the device.
Barrier: With the Barrier API, we can detect changes on Wi-Fi status. For example, when user opened Wi-Fi option or connected to any Wi-Fi point, we can detect it.
Before starting to learn how to work with Wi-Fi Status Awareness by using Capture API, I want to talk about one use case where we can use this awareness.
If I have to give use case example for Wi-Fi Status Awareness, we can use this feature on app which users need to download something. For example, music app, app market and etc.Users make download on these kind applications. Downloading huge size of musics, app and etc. on mobile network can cause problem on our bill. It is better to check that user is connected to Wi-Fi while trying to download huge size file or app. Thus, we can show a dialog to notify the user about that device is not connected to any Wi-Fi network.
Getting Permission​Before working with Wi-Fi Status Awareness, we need to obtain accessing wi-fi state permission in our AndroidManifest.xml file.
"android.permission.ACCESS_WIFI_STATE"
Setting Data Processing Location​We need to set data processing location on AppGallery Connect. If we don’t set any data processing location, we will get the following error.
To set data processing location, we can open our project and on general information tab, we can find the following settings. We need to click on Set button.
After we have clicked on the button, following dialog will be shown. We can choose data processing location here and I will choose Germany.
Capture​With Capture API, we can obtain the current status of the Wi-Fi. While working with Capture API, it returns us 3 different statuses which are Connected, Enabled and Disabled.
If we think according to use case which I have mentioned above as downloading an app or files such as music, we need to check Wi-Fi status when user has been clicked on the download button.
viewBinding.downloadButton.setOnClickListener {
Awareness.getCaptureClient(this).wifiStatus
.addOnSuccessListener { wifiStatusResponse ->
when (wifiStatusResponse.wifiStatus.status) {
WifiStatus.CONNECTED -> {
startToDownload()
}
WifiStatus.ENABLED -> {
navigateToWiFiSettings()
}
WifiStatus.DISABLED -> {
navigateToWiFiSettings()
}
}
}
.addOnFailureListener {
awarenessRequestFailed()
}
}
I want to give code sample in simplest way and that’s why I only give how to work with Capture API of Wi-Fi Status Awareness feature of Awareness Kit.As I mentioned above, there are three different statuses with Capture API.
If user has connected to any Wi-Fi network, status will be ‘Connected’.
If user has enabled the Wi-Fi but hasn’t connected to any Wi-Fi network, status will be ‘Enabled’. We can navigate user to Wi-Fi settings screen or develop different logic according to our app.
If user has not enabled the Wi-Fi settings yet, status will be ‘Disabled’. We can navigate user to Wi-Fi settings screen or develop different logic according to our app.
To navigate user to Wi-Fi settings screen of the device, we can use the following method if we won’t do any other special operations according to logic of our app.
private fun navigateToWiFiSettings() {
startActivity(Intent(Settings.ACTION_WIFI_SETTINGS))
}
Tips & Tricks
Don't forget to set data processing location. If you don't set any location, we can have an error which has error code 10008
Conclusion
These features which I have explained Wi-Fi Status Awareness feature of Huawei Awareness Kit. Huawei Awareness Kit has many more Awareness features. I recommend you to examine these features too. If you have any questions, you can reach me out from "[email protected]"
References
Huawei Awareness Kit Documentation
HMS Core GitHub - Awareness Kit Demo Repository

【DTM】Visual Event Tracking for Web Pages (Three)

In the previous articles, we discussed common visual event tracking and tag template-based visual event tracking. In this article, I'll be introducing you to visual event tracking by HUAWEI Analytics.
What Is Visual Event Tracking by HUAWEI Analytics?​This mode is used to add visual events for scenarios where HUAWEI Analytics is used. HUAWEI Analytics creates visual event tracking templates based on common industry scenarios. This mode is applicable to scenarios where analysis reports are viewed on HUAWEI Analytics.
1.1 Accessing the Visual Event Tracking Page​1. Go to HUAWEI Analytics > Intelligent data access > Tracing by coding, and click Visual tracking next to a report.
2. In the dialog box displayed, select an app to add visual events, and click Set tracing event. The Visual event page in DTM will be displayed.
3. Select the tag template automatically generated in the Select tag template area on the left. In the Add area on the right, confirm the website URL for adding visual events and click Start.
{
"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.2 Adding Visual Events​1. On the Add visual event page displayed, click Add on the right.
2. Select the element type for adding visual events.
3. Select an element on the left page. If the element is of the same type as other elements, a dialog box will be displayed.
If you click OK, all elements of the same type will be selected. If you click Cancel, only the current element is selected.
4. On the Add visual event page, select a visual event name from the Name drop-down list box.
Options for Name come from the report template in HUAWEI Analytics, and cannot be added or modified.
5. In the Parameter area, set Value for each Key, and click OK.
Options in the Key drop-down list box come from the report template in HUAWEI Analytics, and mandatory options cannot be deleted or modified.
6. (Optional) Click relevant icons next to an added visual event to pause, edit, delete, and view details about the visual event as needed.
1.3 Creating and Releasing a Version​1. Click Create on the Version tab page.
2. On the Create version page, enter a version name and description.
3. Select Create and release version.
4. Click OK.
1.4 Triggering a Visual Event​1. Refresh the tested website and download the latest DTM configuration.
Note: By default, the DTM JavaScript SDK downloads the latest DTM configuration to the cache every 15 minutes. To download the latest DTM configuration immediately, disable the browser cache and refresh the tested website again.
2. Click any Detail button under HUAWEI Mate Series.
3. View reported data on HUAWEI Analytics.
To learn more about DTM, click here.
For more details, you can go to:
Reddit to join our developer discussion
GitHub to download demos and sample codes
Stack Overflow to solve any integration problems
Original Source

Categories

Resources