You can use the quick app web component to quickly package an HTML5 game into a quick game. As long as the URL of the original HTML5 game remains unchanged, the quick app does not need to be upgraded, which reduces the maintenance workload.
You can package a quick game in the Quick App IDE in just 7 steps.
1. Download the Quick App IDE from Installing the Development Tool and install it on your PC.
2. Go to File > New Project > New QuickApp Project and create a project. Choose HTML5 Game in Template.
l App Name: app name, which corresponds to the name field in the manifest.json file.
l Package Name: app package name, which corresponds to the package field in the manifest.json 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"
}
3. Click Ok to create a quick game project.
4. Configure the manifest.json file.
l package: quick game package name. Once the game is released, the package name cannot be changed. Otherwise, the game cannot be upgraded.
l name: quick game name.
l versionName: quick game version name. The value must be increased by 1 upon upgrade. For example, if the name of the source version is 1.0.0, the name of the target version must be 2.0.0.
l versionCode: quick game version number. The value must be increased by 1 upon upgrade. For example, if the number of the source version is 1, the number of the target version must be 2.
l icon: quick game logo used in a shortcut icon created on the home screen. Replace logo.png with the HTML5 game icon.
l minPlatformVersion: minimum platform version with which an app is compatible, which functions like the Android API level. You are advised to set the platform to the latest version, for example, version 1070, to avoid incompatibility.
Code:
{
"package": "com.huawei.quickgamedemo",
"name": "QuickGameDemo",
"versionName": "1.0.0",
"versionCode": 1,
"icon": "/Common/logo.png",
"minPlatformVersion": 1070,
"features": [
{
"name": "system.prompt"
},
{
"name": "service.pay"
},
{
"name": "service.account"
}
],
"permissions": [
{
"origin": "*"
}
],
"config": {},
"router": {
"entry": "Hello",
"pages": {
"Hello": {
"component": "hello"
}
}
},
"display": {
"titleBar": false,
"fullScreen": true
}
}
3. Edit the .ux file for loading the HTML5 game. The project takes hello.ux as an example.
l src: URL of the HTML5 game.
l fullscreendirection: game orientation. Both landscape and portrait orientations are supported.
l jumppolicy: URL redirection policy within the game. If ads are integrated into the game, you are advised to set this parameter to browser and set the value of multiwindow to true.
l allowthirdpartycookies: indicates whether cross-domain cookies transfer is supported. The default value is false. If a web page needs to access cookies across domains, for example, in the scenario of sign-in with a third-party account, set this parameter to true.
l trustedurl: Set this parameter if the launch page is different from the loading page displayed after a user has successfully signed in.
4. Go to Tools > Certificate to check whether a formal certificate has been generated. If no certificate is generated, click Create to generate one and save it to the sign > release directory of the project. Keep the file properly as it cannot be retrieved once lost.
5. Go to Build > Run Release to package a formal .rpk package, which is stored in the dist directory of the project.
Note: The .rpk file for release on AppGallery must be packaged following the preceding method.
The final directory structure of the quick game project is as follows:
Now, you have successfully packaged the HTML5 game into a quick game. If you want to integrate more functions into the game, or test and run your game, please refer to the Quick Game Development Guide (HTML5).
For details about Huawei developers and HMS, visit the website.
https://forums.developer.huawei.com/forumPortal/en/home?fid=0101246461018590361
Related
You can use the quick app web component to quickly package an HTML5 game into a quick game. As long as the URL of the original HTML5 game remains unchanged, the quick app does not need to be upgraded, which reduces the maintenance workload.
You can package a quick game in the Quick App IDE in just 7 steps.
1. Download the Quick App IDE from Installing the Development Tool and install it on your PC.
2. Go to File > New Project > New QuickApp Project and create a project. Choose HTML5 Game in Template.
App Name: app name, which corresponds to the name field in the manifest.json file.
Package Name: app package name, which corresponds to the package field in the manifest.json 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"
}
Click Ok to create a quick game project.
Configure the manifest.json file.
package: quick game package name. Once the game is released, the package name cannot be changed. Otherwise, the game cannot be upgraded.
name: quick game name.
versionName: quick game version name. The value must be increased by 1 upon upgrade. For example, if the name of the source version is 1.0.0, the name of the target version must be 2.0.0.
versionCode: quick game version number. The value must be increased by 1 upon upgrade. For example, if the number of the source version is 1, the number of the target version must be 2.
icon: quick game logo used in a shortcut icon created on the home screen. Replace logo.png with the HTML5 game icon.
minPlatformVersion: minimum platform version with which an app is compatible, which functions like the Android API level. You are advised to set the platform to the latest version, for example, version 1070, to avoid incompatibility.
Code:
{
"package": "com.huawei.quickgamedemo",
"name": "QuickGameDemo",
"versionName": "1.0.0",
"versionCode": 1,
"icon": "/Common/logo.png",
"minPlatformVersion": 1070,
"features": [
{
"name": "system.prompt"
},
{
"name": "service.pay"
},
{
"name": "service.account"
}
],
"permissions": [
{
"origin": "*"
}
],
"config": {},
"router": {
"entry": "Hello",
"pages": {
"Hello": {
"component": "hello"
}
}
},
"display": {
"titleBar": false,
"fullScreen": true
}
}
Edit the .ux file for loading the HTML5 game. The project takes hello.ux as an example.
src: URL of the HTML5 game.
fullscreendirection: game orientation. Both landscape and portrait orientations are supported.
jumppolicy: URL redirection policy within the game. If ads are integrated into the game, you are advised to set this parameter to browser and set the value of multiwindow to true.
allowthirdpartycookies: indicates whether cross-domain cookies transfer is supported. The default value is false. If a web page needs to access cookies across domains, for example, in the scenario of sign-in with a third-party account, set this parameter to true.
trustedurl: Set this parameter if the launch page is different from the loading page displayed after a user has successfully signed in.
6. Go to Tools > Certificate to check whether a formal certificate has been generated. If no certificate is generated, click Create to generate one and save it to the sign > release directory of the project. Keep the file properly as it cannot be retrieved once lost.
7. Go to Build > Run Release to package a formal .rpk package, which is stored in the dist directory of the project.
Note: The .rpk file for release on AppGallery must be packaged following the preceding method.
The final directory structure of the quick game project is as follows:
Now, you have successfully packaged the HTML5 game into a quick game. If you want to integrate more functions into the game, or test and run your game, please refer to the Quick Game Development Guide (HTML5).
You can use the quick app web component to quickly package an HTML5 game into a quick game. As long as the URL of the original HTML5 game remains unchanged, the quick app does not need to be upgraded, which reduces the maintenance workload.
You can package a quick game in the Quick App IDE in just 7 steps.
1. Download the Quick App IDE from Installing the Development Tool and install it on your PC.
2. Go to File > New Project > New QuickApp Project and create a project. Choose HTML5 Game in Template.
*App Name: app name, which corresponds to the name field in the manifest.json file.
Package Name: app package name, which corresponds to the package field in the manifest.json 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"
}
3. Click Ok to create a quick game project.
4. Configure the manifest.json file.
package: quick game package name. Once the game is released, the package name cannot be changed. Otherwise, the game cannot be upgraded.
name: quick game name.
versionName: quick game version name. The value must be increased by 1 upon upgrade. For example, if the name of the source version is 1.0.0, the name of the target version must be 2.0.0.
versionCode: quick game version number. The value must be increased by 1 upon upgrade. For example, if the number of the source version is 1, the number of the target version must be 2.
icon: quick game logo used in a shortcut icon created on the home screen. Replace logo.png with the HTML5 game icon.
minPlatformVersion: minimum platform version with which an app is compatible, which functions like the Android API level. You are advised to set the platform to the latest version, for example, version 1070, to avoid incompatibility.
HTML:
{
"package": "com.huawei.quickgamedemo",
"name": "QuickGameDemo",
"versionName": "1.0.0",
"versionCode": 1,
"icon": "/Common/logo.png",
"minPlatformVersion": 1070,
"features": [
{
"name": "system.prompt"
},
{
"name": "service.pay"
},
{
"name": "service.account"
}
],
"permissions": [
{
"origin": "*"
}
],
"config": {},
"router": {
"entry": "Hello",
"pages": {
"Hello": {
"component": "hello"
}
}
},
"display": {
"titleBar": false,
"fullScreen": true
}
}
3. Edit the*.ux file for loading the HTML5 game. The project takes hello.ux as an example.
src: URL of the HTML5 game.
fullscreendirection: game orientation. Both landscape and portrait orientations are supported.
jumppolicy: URL redirection policy within the game. If ads are integrated into the game, you are advised to set this parameter to browser and set the value of multiwindow to true.
allowthirdpartycookies: indicates whether cross-domain cookies transfer is supported. The default value is false. If a web page needs to access cookies across domains, for example, in the scenario of sign-in with a third-party account, set this parameter to true.
trustedurl: Set this parameter if the launch page is different from the loading page displayed after a user has successfully signed in.
4. Go to Tools > Certificate to check whether a formal certificate has been generated. If no certificate is generated, click Create to generate one and save it to the sign > release directory of the project. Keep the file properly as it cannot be retrieved once lost.
5. Go to Build > Run Release to package a formal*.rpk package, which is stored in the dist directory of the project.
Note: The*.rpk file for release on AppGallery must be packaged following the preceding method.
The final directory structure of the quick game project is as follows:
Now, you have successfully packaged the HTML5 game into a quick game. If you want to integrate more functions into the game, or test and run your game, please refer to the Quick Game Development Guide (HTML5).
1. Cocos Creator tool
2. Notepad++ for editing and writing script
3. HMS Device
4. Android Studio for Analyzing APK and Checking Log
1. Install and launch cocos creator.
2. Make sure to configure NDK Root and Android SDK Root in Cocos Creator, choose File> Settings>Select Native Develop.
In the same build popup, In the keystore section we can use default keystore (default location is /Users/<username>/.android/debug.keystore) and we can generate SHA key or we can create custom keystore and can generate SHA key.
In Command line terminal execute the command below and get SHA key:
Code:
keytool -list -v -keystore keystorepath\keystorename.keystore
4. Step 1: Create a project in AppGallery using created SHA key
Step 2: Configure the signing certificate fingerprint
Choose Project settings > General information. In the App information area, click the icon next to SHA 256 certificate fingerprint, and enter the obtained SHA-256 certificate fingerprint.
Step 3: Download agconnect-services.json file and put in setting folder in cocos project.
Example:
Right click on Assets folder and then select Open in explorer and
{
"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"
}
And put agconnect-services.json file inside settings folder
5. Click Enable for Cocos SDKHub in Service tab.
Click on association button and register project in Cocos Console
Associating a Game in Cocos Creator
You can enable third-party services for your app in Cocos Creator. But first, you need to set a Cocos AppID. Select a created game, and click Association, as shown in the following figures.
Select Ads option in Plugin Manager under Service tab.
Place mouse cursor over the "Configured" text so that "Edit" and "Delete" icons will be appeared. Click on edit icon and put public key(from AppGallery connect) in the "Payment Public key" field and select "en" option for "Support language" field and then click OK.
Code:
invokeBannerAds()
{
var params = { "adType": "Banner", "adId": "testw6vs28auh3", "pos": "0", "adSize": "BANNER_SIZE_320_50" };
sdkhub.getAdsPlugin().showAds(params);
},
invokepreloadrewardAds()
{
var params = { "adType": "Reward", "adId": "testx9dtjwj8hp" };
sdkhub.getAdsPlugin().preloadAds(params);
},
invokeRewardAds()
{
var params = { "adType": "Reward", "adId": "testx9dtjwj8hp" };
sdkhub.getAdsPlugin().showAds(params);
},
invokeNativeAdfull()
{
var params = { "adType": "Native", "adId": "testy63txaom86", "nativeLayout": "native_full", "requestCustomDislikeThisAd": "1", "choicesPosition": "3", "videoConfiguration" : "1", "audioFocusType" : "NOT_GAIN_AUDIO_FOCUS_WHEN_MUTE", "startMuted" : "0", "customizeOperateRequested" : "1"};
sdkhub.getAdsPlugin().showAds(params);
},
invokeNativeAd()
{
var params = { "adType": "Native", "adId": "testy63txaom86", "nativeLayout": "native_small", "requestCustomDislikeThisAd": "1", "choicesPosition": "3", "videoConfiguration" : "1", "audioFocusType" : "NOT_GAIN_AUDIO_FOCUS_WHEN_MUTE", "startMuted" : "0", "customizeOperateRequested" : "1"};
sdkhub.getAdsPlugin().showAds(params);
},
invokepreIntertitialsAds()
{
var params = { "adType": "Interstitial", "adId": "testb4znbuh3n2" }; sdkhub.getAdsPlugin().preloadAds(params);
},
invokeIntertitialsAds()
{
var params = { "adType": "Interstitial", "adId": "testb4znbuh3n2" };
sdkhub.getAdsPlugin().showAds(params);},
Banner Ad
Native Ad small
Native Ad Full
Reward Ad
Interstitial Ad
Tips and Tricks
1. Make sure to keep the same package name as kept in the Huawei AppGallery Connect project.
2. Both rewarded ads and interstitial ads need to call preloadAds first, and then call showAds afte receiving successful callback. Banner ads can directly call showAds
Conclusion:
HUAWEI Ads Service is a monetization service that leverages Huawei’s extensive data capabilities to display targeted, high quality ad content in your apps to the vast user base of Huawei devices.
References:
https://docs.cocos.com/creator/manual/en/cocos-service/sdkhub-plugins/sdkhub-hms.html
https://developer.huawei.com/consumer/en/hms/huawei-iap/
Hi, this topic is regarding HMS Ads Service, but you given In-App-Purchase link in reference.
Great news!
Good new Incoming about Huawei
1. Environment
SDK Version:agconnect-storage:1.3.0.300
Platform:Cocos Creator
Device:HUAWEI P40 Pro
AppGallery Connect:
https://developer.huawei.com/consumer/en/service/josp/agc/index.html
2. Enabling and Configuring Cloud Functions in AppGallery Connect
Note: Currently, Cloud Functions is still under beta state. To use the service, you need to send an email for application. For details, check:
https://developer.huawei.com/consum...allery-connect-Guides/agc-cloudfunction-apply
1. Create an app first and add it to a project, or select an app from the project list on the My projects page in AppGallery Connect.
Under the project, go to Build > Cloud Functions, and click Enable now.
2. Create a function based on the description in the following codelab.
https://developer.huawei.com/consumer/en/codelab/CloudFunctions/index.html#4
3. Create an HTTP trigger and save the suffix of the value of Trigger URL in the Details area as the trigger identifier of future client requests.
{
"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. Integrating the Cloud Functions SDK in Cocos Creator
1. Integrate the SDK.
Official documentation:
https://docs.cocos.com/creator/manual/en/cocos-service/agc-applinking.html
1. On the Service panel of Cocos Creator, find Cloud Functions. Currently, the Cloud Functions SDK supports only the Android platform.
2. Before integrating a service, you need to associate the service with an app. Click Association. In the dialog box that is displayed, click Create. The Cocos console is displayed.
3. On the Cocos console, create a game.
4. Go back to Cocos Creator and create, refresh, or select an association.
5. Return to the Cloud Functions page, and enable the service.
2. Download the JSON file.
1. Go to Project settings in AppGallery Connect and download the latest agconnect-services.json file.
2. Save the downloaded agconnect-services.json file to the settings directory in your Cocos project.
4. Configuring the UI Layout
Configure buttons for triggering a cloud function, obtaining the timeout interval, and setting the timeout interval separately.
5. Cloud Functions Development
1. Initialize Cloud Functions in the start block.
Code:
start () {
this._func = huawei.agc.func.funcService;
},
2. Call Cloud Functions with input parameters.
Code:
callWithParam:function() {
this._func.wrap("testcodelab-$latest").call((err, data) => {
if (err !== null) {
console.log("Cloud Function", `error: ${JSON.stringify(err)}`);
}
console.log("Cloud Function", `result: ${JSON.stringify(data)}`);
}, {
year: "2020",
}
);
},
3. Call Cloud Functions without input parameters.
JavaScript:
callWithoutParam:function() {
this._func.wrap("testcodelab-$latest").call((err, data) => {
if (err !== null) {
console.log("Cloud Function", `error: ${JSON.stringify(err)}`);
}
console.log("Cloud Function", `result: ${JSON.stringify(data)}`);
});
},
4. Obtain and set the timeout interval of a function.
JavaScript:
setTime:function() {
this._func.wrap("testcodelab-$latest").setTimeout(100,3);
console.log("Cloud Function", `setTime: ` + 100);
},
getTime:function() {
let currTime = this._func.wrap("testcodelab-$latest").getTimeout();
console.log("Cloud Function", `currTime: ` + currTime);
},
6. Packaging and Testing
In Cocos Creator, go to Project > Build…, package an Android app, and install it to your device. To verify the functions, click the buttons from top to bottom.
If the following information is displayed in JavaScript logs, the integration is successful.
7. Summary
Cloud Functions allows you to keep all functions and related code on the cloud side. You only need to call the wrap.call method to trigger the functions, which reduces the code amount and package size of your APK package.
For more details, please check:
Cloud Functions development guide:
https://developer.huawei.com/consum...connect-Guides/agc-cloudfunction-introduction
Cocos documentation:
https://docs.cocos.com/creator/manual/en/cocos-service/agc-cloudfunc.html
The Huawei AppGallery Connect Crash service is a free to use crash analytics service which is supported on a wide range of platforms and frameworks.
Today lets take a look at how we can use in in a Xamarin, a hybrid framework and specifically set it up to work on iOS devices. This guide will start with a blank application but of course you can just as easily follow along and integrate into a pre-existing application!
Preparing the Xamarin Environment and Configuring Your ProjectYou need to install Visual Studio for MAC first, and then select Mobile development with .NET in Visual Studio to install the Xamarin environment.
{
"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 project in AppGallery Connect and enable HUAWEI Analytics.
Right-click your project and choose Manage NuGet Packages.
Find the Huawei.Agconnect.iOS.Crash package and install it.
Find the Huawei.Agconnect.iOS.AgconnectCore package, select the 1.2.0.300 version, and install it.
Add the plist file from your AppGallery Project to the project directory.
Set Build Action to BundleResource.
Developing Your AppStart by Configure the layout of your app for the testing of the crash service, in this example we will create three buttons to trigger different tests.
Double-click main.storyboard to launch Xcode, and create the MakeCrash, CatchException, and CustomReport buttons
In the MainActivity.cs file, call AGConnectCrash.Instance.TestIt to trigger a crash, call AGConnectCrash.Instance.SetUserId to set a custom user ID, call AGConnectCrash.Instance.SetCustomKey to set the key and value for a custom key-value pair, call AGConnectCrash.Instance.Log to set the log level, and call AGConnectCrash.Instance.RecordException to record a non-fatal exception.
This could look something like:
Code:
using System;
using UIKit;
using Huawei.Agconnect.Crash;
using Foundation;
namespace crashios0512
{
public partial class ViewController : UIViewController
{
public ViewController(IntPtr handle) : base(handle)
{
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
// You can configure additional functions as required.
}
public override void DidReceiveMemoryWarning()
{
base.DidReceiveMemoryWarning();
// Delete the cached data or images that are no longer used.
}
partial void MakeCrash(UIKit.UIButton sender)
{
AGCCrash.GetSharedInstance().TestIt();
}
partial void CatchException(UIKit.UIButton sender)
{
AGCCrash.GetSharedInstance().RecordError(new Foundation.NSError());
}
partial void CustomReport(UIKit.UIButton sender)
{
AGCCrash.GetSharedInstance().SetUserId("testuser");
AGCCrash.GetSharedInstance().Log("default info level");
AGCCrash.GetSharedInstance().SetCustomValue(new NSString("test"), "this is string value");
AGCCrash.GetSharedInstance().LogWithLevel(AGCCrashLogLevel.Warning, "this is warning log level");
AGCCrash.GetSharedInstance().SetCustomValue(new NSNumber(123), "this is number");
}
}
}
View Crash ReportTap MakeCrash, CatchException, and CustomReport in sequence, and check the report in AppGallery Connect.
View the crash statistics.
Check the exceptions
Diagnose the causes of exceptions.
Check the custom key-value pairs.
View the custom log levels
View custom user IDs.
For details, please refer to:
Crash for iOS
Codelab of Crash for iOS
Will it works on offline?
will its benefit for us or not? Epoxy Flooring Atlanta