生态查询服务支持Phone、Tablet、PC/2in1设备。如果应用或者元服务没有产生场景值,调用getSelfSceneCode接口返回的场景值为空。怎么理解这个概念呢?#跟着万少学鸿蒙
wanmeijuhao 2025-10-16 21:41:40 harmonyos
生态查询服务支持Phone、Tablet、PC/2in1设备。如果应用或者元服务没有产生场景值,调用getSelfSceneCode接口返回的场景值为空。怎么理解这个概念呢?#跟着万少学鸿蒙
您需要先 登录 才能评论/回答
全部评论(1)
- 生态查询服务支持Phone、Tablet、PC/2in1设备。并且从5.1.1(19)版本开始,新增支持TV设备。
- 如果应用或者元服务没有产生场景值,调用getSelfSceneCode接口返回的场景值为空。
- 生态查询服务不支持模拟器,请使用真机调试。
接口说明
生态查询服务场景提供以下接口,具体API说明详见接口文档。

查询自身场景值
- 导入模块。
-
import { hilog } from '@kit.PerformanceAnalysisKit'; import { sceneManager } from '@kit.AppGalleryKit';调用getSelfSceneCode方法。
-
try { const sceneCode: string = sceneManager.getSelfSceneCode(); hilog.info(0, 'TAG', "Succeeded in getting SelfSceneCode res = " + sceneCode); } catch (error) { hilog.error(0, 'TAG', `getSelfSceneCode failed. code is ${error.code}, message is ${error.message}`); }查询广告验签版本
- 导入模块
-
import { hilog } from '@kit.PerformanceAnalysisKit'; import { sceneManager } from '@kit.AppGalleryKit'; -
try { const version: number = sceneManager.getAdsVerificationVersion(); hilog.info(0, 'TAG', "Succeeded in getting AdsVerificationVersion res = " + version); } catch (error) { hilog.error(0, 'TAG', `getAdsVerificationVersion failed. code is ${error.code}, message is ${error.message}`); }#跟着万少学鸿蒙
2025-10-16 21:43:14