Huawei Quick Game SDK access pitfall records

Frequently asked questions about Huawei Quick Game being rejected:
  1. The copyright owner, healthy game advice and other information are not fully displayed before the game starts (the page stay time should not be too short, if it is too short, the review may not be passed)
  2. Some requests for rewarded videos are real-time and not preloaded.
  3. After entering the app without privacy permissions or agreeing to privacy permissions, you still need to agree next time you open it (this can be checked by default, and it will not appear again after the user clicks the consent button next time he enters the game)
  4. Native advertising has no advertising source
Huawei Quick Game was dismissed due to technical issues:
  1. After the incentive video is played, no resurrection reward will be issued.
  2. There are no interstitial ads in the deliverables, and interstitial preloading appears.
  3. Native ad slots do not match deliverables
  4. After returning to native advertising after switching interfaces, no exposure is reported for ad display.
  5. Incentive video clicks cannot be viewed
  6. There is an ad request for native advertising, but no ad is returned.
  7. Native page UI without advertising logo
New rules:
Kuaiya Incentive Video must choose two sizes: 640*360 and 720*1280
Uncheck the box to use the official version signature and do not use the official version signature.
1. Resource loading error:
solution:
(1) Step one:
In the libs library folder, you need to import the file: laya.hwmini.js
(2) Packaging tool: layaIDE version 2.8.1 or above:
(3) Adapt to Huawei: Document Center
Since the   XMLHttpRequest  implemented by Kuaiyu Game Platform does not support reading local files, it is necessary to add an adaptation to read local files. The following is the adaptation to  different Laya versions .
   //The first adaptation code is here, insert and add adaptation to read local resources
if (typeof loadRuntime !== 'undefined' && !url.startsWith("http")) {
   let that = this;
    setTimeout(() => {
        if (url.startsWith('file://')){
            url = url.substr('file://'.length);
        }
        url = URL.getAdptedFilePath(url);//对资源后缀转化,Laya 自带方法
        var response;
        var type = contentType;
        if (type == 'pkm' || type === "arraybuffer") {
            response = qg.getFileSystemManager().readFileSync(url);
        } else {
            response = qg.getFileSystemManager().readFileSync(url, "utf8");
            if ((type == 'atlas' || type == 'json') && typeof response !== "undefined") {
                response = JSON.parse(response);
            }
        }
        that.onLoaded(response);
    }, 0);
    return;//这里记得 return
}

//The first addition of the adaptation code ends. The following is the original laya code.
 
           //第二处适配代码
            if (Browser.onVVMiniGame || typeof qg !== "undefined") {
                this._http = new HttpRequest();
            }
            else {
                if (!this._http)
                    this._http = new HttpRequest();
            }
            // if (Browser.onVVMiniGame) {
            //     this._http = new HttpRequest();
            // }
            // else {
            //     if (!this._http)
            //         this._http = new HttpRequest();
            // }

2. Sound effect error: Huawei has made special adaptations for sound effects and music:
(1) Play music for Huawei adaptation:
      
  if (window.hbs) {//华为播放音乐
            this._bgm = hbs.createInnerAudioContext();
            this._bgm.src = file;
            this._bgm.loop = true;
            this._bgm.play();
        } else if (Laya.Browser.onMiniGame) {
            if (!this._bgm)
                this._bgm = wx.createInnerAudioContext();
            this._bgm.src = file;
            this._bgm.loop = true;
            this._bgm.play();
        } else if (window.isApp && zs.Native && window.qg) {
            if (!this._bgm)
                this._bgm = qg.createInnerAudioContext();
            this._bgm.src = file;
            this._bgm.loop = true;
            this._bgm.play();
        } else {
            if (!this._bgm)
                this._bgm = Laya.SoundManager.playMusic(file, 0, undefined, (this._bgm && this._bgm.url === file) ? this._bgm.position : 0);
        }

(2) Play sound effects for Huawei adaptation:
  
      if (window.hbs) {
            sound = hbs.createInnerAudioContext();
            sound.src = config.file;
            sound.loop = loop;
            sound.volume = config.musicPower * this.soundVolume;
            sound.play();
        } else {
            sound = Laya.SoundManager.playSound(config.file, loop ? 0 : 1);
            sound && power != void 0 && (sound.volume = power);
        }

3. Huawei screen adaptation: Add at the end of Main.js:
 
//华为屏幕适配
if (typeof hbs !== 'undefined') {
    Laya.stage.useRetinalCanvas = true;
    if (typeof getAdapterInfo !== "undefined") {
        var stage = Laya.stage;
        var info = getAdapterInfo({ width: stage.designWidth, height: stage.designHeight, scaleMode: stage._scaleMode });
        //注意:其中 GameConfig.width 和 GameConfig.height 为该demo中设置游戏的宽和高,请根据实际项目填写
        stage.designWidth = info.w;
        stage.designHeight = info.h;
        stage.width = info.rw;
        stage.height = info.rh;
        stage.scale(info.scaleX, info.scaleY);
    }
}


4.必须主动在index.js中引入华为的库文件:

if (window.hbs) {  //打包华为必须主动引入
    loadLib("libs/laya.hwmini.js");
}

5. Huawei called login and failed: Game login failed, error code: AUTH FAIL, code: -1
Solution:
Reporting -1 is a fingerprint issue. Use the local loader to test rpk. You can see the fingerprint of the game in the loader, and then see if it is consistent with the fingerprint of the application on the AGC official website.
Long press the application on the loader and you can see the fingerprint through management
6. Before Huawei Pack goes online for the first time, all advertisements must be retrieved using test IDs:
Test ad id:
native testy63txaom86
banner testw6vs28auh3
Incentive testx9dtjwj8hp
Insert screen testb4znbuh3n2
7. Huawei privacy policy website:

Guess you like

Origin blog.csdn.net/woshiyuyanjia/article/details/134728660