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

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

Related

Optimize Conversion Rate Using A/B Testing

This article is originally from HUAWEI Developer Forum
Forum link: https://forums.developer.huawei.com/forumPortal/en/home​Experiment your ideas, make your changes in website/Applications, AB Testing analytics will help you find which experiment results better conversion rate optimization.
Introduction
A/B Testing (also known as Split Testing), A/B testing is a fantastic method for find out the best online advertisement and marketing strategies. designers are using it at this very moment to obtain valuable insight regarding visitor behavior and to improve applications or website conversion rate.
A/B testing involves sending half your users to one version of a page, and the other half to another, and watching the analytics to see which one is more effective in getting them to do what you want them to do (for example, sign up for a user account), this helps you make reach more audience.
Implementation Process
1. Enabling A/B Testing, Access dependent service
2. Create an experiment
3. Manage an experiment
Enabling A/B Testing
· Create sample application in android and configure into AGC.
· Enable Push service and Analytics
· Open AGC select sample project Growing->A/B testing Now enable A/B testing.
After enabling service, you will get options
· Create notifications experiment.
· Create remote configuration experiment.
Creating an Experiment
Create Remote Configuration Experiment
The best way to implement new feature or an updated user experience, based on user response you can implement features. follow below steps.
Click create remote configuration experiment you will get below screen
{
"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"
}
Open AGC -> select project->Growing->Remote Configuration enable service
Now open A/B Testing tab.
Declare name and description then click Next Button.
· In target user page, set filter conditions, select target user ratio.
· Click Conditions and select one of the following filter conditions.
Version: Select the version of the app.
Language: Select the language of the device
Country/Region: Select the country or region where the device is located.
Audience: Select the audience of HUAWEI Analytics Kit.
User attributes: Select the user attributes of HUAWEI Analytics Kit
After the setting is complete, click Next.
· Create Treatment & Control Groups
To add multiple parameters using new parameter option.
To add multiple treatment group using New treatment group option.
You can create customize parameter names.
· After filling all details done, click next button.
· Create Track Indicators
Select main and optional indicators, then save all details
· After saving all details you will get below screen.
· After experiment created you can follow below steps.
Test the experiment
Start the experiment
View the report
Increase the percentage of users who participate in the experiment.
Release the experiment
Test an Experiment
Before starting an experiment, you need to test individually.
· Generate AAID
· Using Add test user and add an AAID of a test user.
· Run your app on the test user device and ensure that the test user can receive information.
· Follow below step to generate AAID.
Code:
private fun getAAID() {
var inst = HmsInstanceId.getInstance(this)
val aaid = inst.id
txtAaid.text=aaid
Log.d("AAID", "getAAID success:$aaid")
}
Starting an experiment
· Click Start operation column and click OK
Viewing an Experiment Report
· You can view experiment reports in any state. The system also provides the following information for each indicator by default
· Increment: The system compares the indicator value of the treatment group with that of the control group to measure the improvement of the indicator.
· Other related indicators: For example, for Retention rate after 1 day, the system also provides data about Retained users.
Releasing an Experiment
· Click Release in the operation column
· Select treatment group set condition name.
· Click Go to Remote configuration button.it will redirect new page.
· If you want modify any parameter values. click operation choose Edit option to modify values, Click Save Button.
Let’s do Code
· Setting Default In-app Parameter Values
Code:
val config = AGConnectConfig.getInstance()
val map: MutableMap<String, Any> = HashMap()
map["test1"] = "test1"
map["test2"] = "true"
config.applyDefault(map)
· Fetching Parameter Values from Remote Configuration
· You can call the fetch API to obtain parameter values from Remote Configuration in asynchronous mode.
· After the API is successfully called, data of the ConfigValues type is returned from Remote Configuration.
· After obtaining parameter value updates, the app calls the apply() method
· Calling the fetch() method within an interval will obtain locally cached data instead of obtaining data from the cloud.
· We can customize the fetch interval
Loading Process
· Applying parameter values Immediately.
Code:
config.fetch()
.addOnSuccessListener { configValues ->
config.apply(configValues)
}
.addOnFailureListener { error ->
Log.d("TAG", error.message)
}
· Applying parameter values upon the next startup
You can fetch parameter values at any time, in this case latest parameter values can be applied without asynchronous waiting.
Code:
val last = config.loadLastFetched()
config.apply(last)
config.fetch()
.addOnSuccessListener {
}
.addOnFailureListener { error ->
Log.d("TAG", error.message)
}
}
Report
Conclusion:
A/B testing which was earlier used mostly on e-commerce portals and websites has now been introduced for Android apps as well. This form of testing was found to be highly effective for the developers.
So, that's how to implement an A/B Testing in your next app.
Any questions about this, you can try to acquire answers from HUAWEI Developer Forum.

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

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

Integrating AppGallery Connect APM on iOS

App Performance Management (APM) of AppGallery Connect provides minute-level app performance monitoring capabilities. You can view and analyze app performance data collected by APM to comprehensively understand the online performance of apps in real-time, helping you to quickly and accurately rectify any app performance problems and continuously improve user experience.
If you happen to need this service, this article is exactly what you are looking for.
Perform the following steps for service integration:
Enable HUAWEI Analytics.
Integrate the SDK into your iOS project.
Design the UI.
Report network events.
Enable/Disable performance data collection.
View and analyze app performance data.
Disable APM performance monitoring.
Enabling the APM Service​The APM service uses the capabilities of HUAWEI Analytics when reporting performance management events. Therefore, you must enable HUAWEI Analytics before integrating the APM SDK. For details, click here to view how to enable the service.
Integrating the SDK​If you are using Xcode, you need to integrate the APM SDK into your Xcode project with CocoaPods.
Add the AppGallery Connect configuration file of the app to your Xcode project.
Sign in to AppGallery Connect and click My projects.
Click your project card and select an app for SDK integration from the app drop-down list on the top.
Go to Project settings > General information and download agconnect-services.plist under App information.
Copy the agconnect-services.plist file to your app’s module directory.
{
"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"
}
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.
Edit the Podfile.
Integrate the Analytics SDK, APM SDK, and Remote Configuration SDK. Edit the Podfile to add the pod dependencies of the Analytics SDK, AppGallery Connect SDK, APM SDK, and Remote Configuration SDK. https://gist.github.com/devwithzachary/22082c3bcd6657de20a46dfe4a1b0216#file-podfile
Install the pod and open the .xcworkspace file to view the project. https://gist.github.com/devwithzachary/7f6fa7c18d30af947048f94499a16972#file-pod-bash
Designing the UI​You can create a page in your Xcode project and design the UI based on the following figure, with three buttons required: one for initiating a network request, one for disabling APM performance monitoring, and one for enabling APM performance monitoring.
Reporting Network Events​You can manually add a time-consuming cyclic log recording operation to trigger a network request, and check whether the launch duration and network performance indicators are normal on the management page of APM. The app launch and screen events are automatically reported when the app is launched. The detailed procedure is as follows:
Initialize the AppGallery Connect SDK, import the header file to the AppDelegate.m file of the project, and add the initialization code. Add a time-consuming cyclic log recording operation and change the number of cycles to observe the change of the launch duration.
2. Create a Send Network Request test button in ViewController in your app. You can tap the button to call sendNetworkRequest to trigger a network request event.
Enabling/Disabling Performance Data Collection​
Create an APM Collection Off test button in ViewController in your app. You can tap the button to call the enableCollection method to disable APM performance monitoring.
2. Create an APM Collection On test button in ViewController in your app. You can tap the button to call the enableCollection method to enable APM performance monitoring.
Viewing and Analyzing App Performance Data​
Sign in to AppGallery Connect and click My projects.
Click your project card and select an app from the app drop-down list on the top.
Go to Quality > APM. Click Overview. The indicator overview includes indicators such as the app launch duration (by version), freeze frame rate ratio (top 5 view controllers), and ANR-affected user rate.
Go to App analysis > App launch duration.
5. Click View details. The app launch duration details page is displayed.
6. (Optional) Select Modify threshold, set the threshold, and click Ok.
7. Go to App analysis > Native page rendering. On the page displayed, you can view the page freezing information (corresponding to ViewController) and then optimize the performance as required.
Disabling APM Performance Monitoring​Method 1: You can disable APM performance monitoring for a released app on the cloud. On the App performance management page, click the Configuration tab, find Overall switch, then disable the switch.
Method 2: You can disable the performance data reporting function for some versions. On the App performance management page, click the Configuration tab and find the app version, then click Add to add the disabled version number to the list.
Method 3: If your app allows users to enable or disable performance monitoring, use the method provided by the APM SDK. Call getInstance for initialization and call enableCollection to enable or disable performance monitoring. The priority of the disabling configuration in apps is higher than that through Remote Configuration in AppGallery Connect. If users disable performance monitoring in apps, APM does not collect performance data even if the performance monitoring function is enabled through Remote Configuration in AppGallery Connect.
Summary​You can add the APM SDK to your app for automatically collecting app performance data without writing any code.
And you can view and analyze app performance data collected by APM in AppGallery Connect to comprehensively understand the online performance of apps in real-time, helping you quickly and accurately rectify any app performance problems and continuously improve user experience.
Reference: HUAWEI AppGallery Connect Crash documentation

FAQs Related to HMS Core Video Editor Kit

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

Categories

Resources