Access Huawei HMS Game service based on Cocos SDKHub—Access Huawei application upgrade service

The application upgrade service refers to the service that detects the updated version and pops up a prompt window after the application is started.

After the SDKHub corresponding interface is integrated, the application will automatically check the version update status of the application in the Huawei application market through the SDK after the application is launched.

The intermodal game review was rejected. The review opinion is that the application upgrade service is not connected. You can also refer to the following methods to access.

The prerequisite for accessing the application upgrade service is to complete the access to the Cocos SDKHub service. Refer to the access to Huawei HMS Game service based on Cocos SDKHub—Access SDKHub . The specific access process is as follows:

Upgrade service access begins:

  1. Refer to the official document interface description to implement the following code:
checkUpdate:function(){
        var params = {
            "showUpdateDialog": "1",
            "forceUpdate": "0" 
        }

        console.log("checkAppUpdate button pressed");
        sdkhub.getUserPlugin().callFuncWithParam("checkAppUpdate",params);//调用华为checkAppUpdate接口
    }
  1. Associate the code file to the specified button and select the click event as the checkUpdate method.

  2. The following exception is thrown in the simulator test, the error message indicates that the method callFuncWithParam is not found, then package it under the real machine test.

Insert picture description here

  1. Real machine test OK

The following information is printed in the log to indicate that the service is successfully connected:

D/jswrapper: JS: checkAppUpdate pressed
I/updatesdk: UpdateSDK version is: 2.0.6.302 ,flavor: envrelease ,pkgName: com.cocos2d.xxx
D/HwConnectivityServiceEx: set 10323 wlan0 value false
I/NetworkKit_a: 27569-28056|null|com.huawei.hms.framework.network.grs.a|a|22|get url from sp is not empty.
I/DeviceUtil: UpdateSDK Get url from GRS_SDK Success!https://store1.hispace.hicloud.com/hwmarket/api/
I/StoreTask: UpdateSDK call store responsecode: 200如果真机测试通过的话,可以忽略上面的模拟器报错,猜测是模拟器适配问题。

For mobile game applications, if you need to force an upgrade, you need to pay attention to two areas:

  1. When editing the new version information on the HUAWEI AGC page, check the corresponding option in "Are you forced to upgrade?"

For details, please refer to step 8 of the official document here .

  1. The forceUpdate is configured as 1 in the input parameters of the above interface.

That's it!

For more details, please see:

Access to Huawei HMS Game service based on Cocos SDKHub—Access SDKHub:https://developer.huawei.com/consumer/cn/forum/topic/0204388296044900043?fid=18

Access to Huawei HMS Game service based on Cocos SDKHub—Packing and putting on shelves process:https://developer.huawei.com/consumer/cn/forum/topic/0201388295004340052?fid=18


Original link:https://developer.huawei.com/consumer/cn/forum/topic/0201436873397060249?fid=18

Author: Mayism

Guess you like

Origin blog.51cto.com/14772288/2606498