HUAWEI Drive Kit Development Process (Part*2) - Huawei Developers

More information like this, you can visit HUAWEI Developer Forum
​
SDK Description
To integrate HUAWEI Drive Kit into your app, you will need to integrate both the HMS SDK and the Drive SDK. The HMS SDK provides sign-in and authentication information, while the Drive SDK provides the capability of managing users' files in Drive.
{
"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"
}
Integrating the Drive SDK and HMS SDK
If you are using Android Studio, you can integrate your Drive SDK and HMS SDK by using the Maven repository. Before you start developing an app, integrate both the Drive SDK and HMS SDK into your Android Studio first.
1. Add the AppGallery Connect configuration file of the app to your Android Studio.
a. Sign in to AppGallery Connect and select My projects.
b. Find your project from the project list and click the app on the project card.
c. On the Project Setting page, click agconnect-services.json to download the configuration file.
d. Copy the agconnect-services.json file to the app root directory.
2. Configure the Maven repository address for the HMS SDK.
a. Open the build.gradle file in the root directory of your Android Studio project.
3. Add build dependencies.
a. Open the build.gradle file in the app directory.
5. Define multi-language settings.
By default, your app supports all languages provided by the HMS SDK.If your app uses all these languages, skip the operation procedure in this section.
If your app uses only some of these languages, follow the operation procedure in this section to complete the required configuration.
Open the build.gradle file in the app directory of your project.
Go to android > defaultConfig and add the resConfigs configuration. en (English) and zh-rCN (Simplified Chinese) are mandatory languages. If your app only supports English and Simplified Chinese, the configuration is as follows:

Related

Integrating HUAWEI Game Service Based on Cocos SDKHub - Packaging and Releasing

You can release a Cocos-based game in HUAWEI AppGallery Connect.
1. Building Your Version
Sign in to Cocos Creator, choose Project > Build & Release, and perform configurations as follows:
Select HUAWEI AppGallery Connect as the release platform.
For a joint operations app or game, the package name must end with*.huawei.
Use the keystore information configured previously.
In Cocos SDKHub, select the HUAWEI AppGallery Connect config set you need.
You are advised to deselect Debug Mode. All Huawei SDK APIs require app signature verification, if Debug Mode is selected, the compiler does not sign your app package by default.
2. Compiling Your Version
You can either compile your game in Cocos Creator or Android Studio.
2.1 Compiling in Cocos Creator
In Cocos Creator, go to Project > Build…, and click Compile after the build is complete.
After compilation, you can find the file in $ProjectHome\build\jsb-link\publish\android.
{
"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.2 Compiling in Android Studio
Open the following directory in Android Studio and compile your game.$ProjectHome \build\jsb-link\frameworks\runtime-src\proj.android-studio
3. Uploading Your Version
You can release your game version either by uploading it in Cocos Creator directly after build and compilation, or by uploading the compiled file in AppGallery Connect.
Method 1: Click Upload next to Compile in Cocos Creator. Select a login type, and enter the app ID of your game, which was generated by AppGallery Connect. You can set other parameters according to the actual situation. Click Confirm, and verify your HUAWEI ID in the displayed dialog box. After verification, your game version will be uploaded to AppGallery Connect. You can later sign in to AppGallery Connect and go to My apps > Distribute > Version information to view it.
Method 2: Sign in to AppGallery Connect, go to My apps > Distribute > Version information, click Software package management, and upload your app package.
For more details, check:
Integrating HUAWEI Game Service Based on Cocos SDKHub - Integrating Cocos SDKHub:https://forums.developer.huawei.com/forumPortal/en/topic/0203404602609800136
AppGallery Connect documentation:https://developer.huawei.com/consumer/en/doc/distribution/app/agc-release_app

HMS AGC CloudStorage Kit Integration in B4A Platform

Overview
Cloud Storage Service allows you to store high volumes of data such as images, audios, and videos generated by your users securely and economically with direct device access. The service is stable, secure, efficient, and easy-to-use, and can free you from development, deployment, O&M, and capacity expansion of storage servers.
In this article, we can learn the following:
Create an app and configure its information in AppGallery Connect.
Use B4A IDE to integrate the HUAWEI HMS Cloud Storage SDK into your app and develop storage-related functions.
Build and demonstrate a demo app.
Manage files on the Cloud Storage page in AppGallery Connect.
For details, refer to
Free IDE for B4X Native Android Development | B4A
B4A includes all the features needed to quickly develop any type of Android app. B4A is used by tens of thousands of developers from all over the world, including companies such as NASA, HP, IBM and others.
www.b4x.com
Creating Wrapper Class
1. Download the following AAR package inside addition folder in your project directory.
HMSSDK AGConnect:
https://developer.huawei.com/repo/c...t-auth/1.4.1.300/agconnect-auth-1.4.1.300.aar
https://developer.huawei.com/repo/c...t-core/1.4.0.300/agconnect-core-1.4.0.300.aar
https://developer.huawei.com/repo/c...age/1.3.0.300/agconnect-storage-1.3.0.300.aar
https://developer.huawei.com/repo/c...e-core/1.4.1.300/datastore-core-1.4.1.300.aar
https://developer.huawei.com/repo/c.../1.4.1.300/datastore-annotation-1.4.1.300.jar
https://developer.huawei.com/repo/c...https/1.4.1.300/agconnect-https-1.4.1.300.aar
https://developer.huawei.com/repo/c.../1.4.1.300/agconnect-credential-1.4.1.300.aar
HMSSDK Base:
https://developer.huawei.com/repo/com/huawei/hms/base/5.0.0.301/base-5.0.0.301.aar
HMSSDK Update:
https://developer.huawei.com/repo/c...pdate/5.0.0.301/availableupdate-5.0.0.301.aar
https://developer.huawei.com/repo/com/huawei/hms/update/2.0.6.302/update-2.0.6.302.aar
HMSSDK Device:
https://developer.huawei.com/repo/com/huawei/hms/device/5.0.0.301/device-5.0.0.301.aar
HMSSDK DynamicAPI:
https://developer.huawei.com/repo/com/huawei/hms/dynamic-api/1.0.13.303/dynamic-api-1.0.13.303.aar
HMSSDK Log:
https://developer.huawei.com/repo/com/huawei/hms/log/5.0.0.301/log-5.0.0.301.aar
HMSSDK Network:
https://developer.huawei.com/repo/c...common/4.0.2.300/network-common-4.0.2.300.aar
https://developer.huawei.com/repo/com/huawei/hms/network-grs/4.0.2.300/network-grs-4.0.2.300.aar
HMSSDK Stats:
https://developer.huawei.com/repo/com/huawei/hms/stats/5.0.0.301/stats-5.0.0.301.aar
HMSSDK Tasks:
https://developer.huawei.com/repo/com/huawei/hmf/tasks/1.4.1.300/tasks-1.4.1.300.aar
HMSSDK UI:
https://developer.huawei.com/repo/com/huawei/hms/ui/5.0.0.301/ui-5.0.0.301.aar
Squareup Libraries:
https://repo1.maven.org/maven2/com/squareup/okhttp3/okhttp/3.11.0/okhttp-3.11.0.jar
https://repo1.maven.org/maven2/com/squareup/okio/okio/1.14.0/okio-1.14.0.jar
Note: After download of the above AAR files, create addition folder inside Project and keep all AAR packages in it.
2. Open each of the AAR package with RAR tool and rename the class.jar and AndroidManifest.xml files. And save those jar files inside libs folder (It is recommended that the two files be renamed consistently with the AAR package names.)
{
"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. Create Library as parent and then create bin, libs and src as subfolder in the project directory.
2. Develop java project inside the following path:
Choose Library Folder > src > b4x > hms > cloudstorage
a. Import the following two lines of code to each Java file.
Code:
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.*;
b. Add necessary annotations to the Java files.
Code:
@Version(1.0f)
@ShortName("CloudStorageFuncs")
@DependsOn(values={
"agconnect-auth-1.4.1.300.aar",
"agconnect-core-1.4.0.300.aar",
"agconnect-storage-1.3.0.300.aar",
"availableupdate-5.0.0.301.aar",
"base-5.0.0.301.aar",
"device-5.0.0.301.aar",
"dynamic-api-1.0.13.303.aar",
"log-5.0.0.301.aar",
"network-common-4.0.2.300.aar",
"network-grs-4.0.2.300.aar",
"stats-5.0.0.301.aar",
"tasks-1.4.1.300.aar",
"ui-5.0.0.301.aar",
"update-2.0.6.302.aar",
"okhttp-3.11.0.jar",
"datastore-core-1.4.1.300.aar",
"datastore-annotation-1.4.1.300.jar",
"agconnect-https-1.4.1.300.aar",
"agconnect-credential-1.4.1.300.aar",
"okio-1.14.0.jar"
})
More details, you can visit https://forums.developer.huawei.com/forumPortal/en/topic/0203411651765670210
Very interesting.

Integration of Huawei Reward Ads and Interstitial Ads in Unity

Overview
In this article, I will create a demo game and integrate Huawei Ads Kit. So the developer can easily monetise their efforts using Reward Ads and Interstitial Ads. I will cover every aspect of the game development with Huawei Ads Kit.
Service Introduction
Ads kit is powered by Huawei which allows the developer to monetization services such as Reward Ads and Interstitial ads. HUAWEI Ads Publisher Service is a monetization service that leverages Huawei's extensive data capabilities to display targeted, high-quality ad content in your game to the vast user base of Huawei devices.
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.
Game Development
1. Create a new game in Unity.
2. Click 3D, enter Project Name, and then click to CREATE.
3. Now add game components and let us start game development.
4. Download HMS Unity Plugin from below site.
https://github.com/EvilMindDevs/hms-unity-plugin/releases
5. Open Unity Engine and import the downloaded HMS Plugin.
Choose Assets > Import Package> Custom Package
6. Choose Huawei > App Gallery.
7. Provide the AppId and other details from agconnect-service.json file and click configure Manifest.
8. Create Huawei Ads based scripts.
I have created AdsDemoManager.cs file in which integrated Huawei Ads which display Reward Ad and Interstitial Ad functionality.
Click on AdsDemoManager.cs and open in Visual Studio 2019
For codes and detailed information, you can check https://forums.developer.huawei.com/forumPortal/en/topic/0203424621102710033
It can be Useful.
Rebis said:
It can be Useful.
Click to expand...
Click to collapse
It will quite great
How can we configure rewards on server ?

How Can I Integrate Remote Configuration of AppGallery Connect in Cordova?

Recently, it is found that AppGallery Connect Remote Configuration starts to support Cordova. The integration is rather simple, let’s have a try.If you want to quickly experience this service, see the demo on GitHub.
Integration Procedure
1. Create a project directory on your computer, run the following npm command to install Cordova.
npm install -g cordova
{
"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. Create a project and enable Remote Configuration.
a) Create an Android app in AppGallery, add it to a project, enable Remote Configuration, and add a parameter.
b) Run the following command to create a Cordova project. In this example, name the project RemoteConfig.
cordova create RemoteDemo com.huawei.cordova.remoteconfig RemoteConfig Creating a new cordova project.
c) Add an app platform to the project.
In the project directory, run cordova platform add android to add the Android platform.
Run cordova platform -l to view the supported platforms.
d) Go to Project settings in AppGallery Connect, download the agconnect-services.json file, and add the file to the android/app directory of your project.
e) Install the AppGallery Connect plug-in.
cordova plugin add @Cordova-plugin-agconnect/remoteconfig --save
After the plug-in is installed, you can view it in the plugins directory.
Add the AppGallery Connect plug-in address to app/build.gradle.
3. Use the Remote Configuration service.
1. Fetch data from the cloud. The data takes effect this time.
Call the fetch API to fetch parameter values from the cloud, and call the apply API to make them take effect.
You can view the fetched parameter values on the cloud in log information.
The other values displayed in log information are local ones.
2. Fetch the cloud data and make the parameter values fetched last time take effect.
Replace the fetch API with applyLastFetch to fetch data that is fetched from the cloud last time.
3. Clear the data.
Call the clearAll API to clear the cached data that is fetched earlier.
4. Fetch the value of a key from the cloud.
Call getValue to fetch related data from the cloud.
4. Compile and install an app package.
Run the cordova build android command to compile the project.
Find the APK package in the build folder in the android directory.
For more details, please check:
Cordova documentation:
https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html
Remote Configuration API Reference:
https://github.com/AppGalleryConnect/agc-demos/tree/main/Cordova/agc-remoteconfig-cordova
Remote Configuration Demo:
https://github.com/AppGalleryConnect/agc-demos/tree/main/Cordova/agc-remoteconfig-cordova

Result Code 28 Reported During Check for an App Package Released Through the Huawei Channel: Copy the assets directory of the HMS Core SDK to the app

Symptom
When I submitted my game to AppGallery Connect for check, the following message was displayed:
Error 28: Copy the assets directory of the HMS SDK to the app project's root directory.
Cause​I submitted a ticket to Huawei technical support, and they told me that the problem occurred because no .bks certificate file was found in the packaged project.
You can also check whether there are .bks files in the project by using a decompiling tool to decompile the package. The following example shows that .bks files exist in the project.
{
"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"
}
Outcome​Usually, when an app calls a service API provided by the HMS Core SDK, for example, the sign-in or payment API, if a user's phone does not have HMS Core (APK) installed or the APK version is too early, a pop-up will be displayed to prompt the user to install or update HMS Core (APK).
The .bks files in the app package ensure that the pop-up is displayed as expected. If such files are missing, service functions may fail to work properly.
Solution​
If you use the Maven repository to integrate the HMS Core SDK in Android Studio, the certificate files are automatically stored in the assets directory of the APK.
If you download the HMS Core SDK package for local integration in Eclipse, the certificate files are included in the HMS Base Eclipse SDK package. You can manually copy the certificate files in the assets directory in each of the folder of the HMS Base Eclipse SDK package to your project's root directory by referring to the official documentation.
My project was developed using Eclipse, so I followed the instructions and copied the .bks files. Then, I submitted the package for check again and it passed.

Categories

Resources