getSystemInfo 方法

作用:

该方法返回酷联 APP 所在的系统的的相关信息。

原型:

interface CoolinkSystemInfo {
  code: number;
  msg?: string;
  os: string;
  iosVersion?: string;
  apiLevel?: string;
  deviceId: string;
  width: number;
  height: number;
  brand: string;
  model: string;
  panel: string;
  mac: string;
  name: string;
  chip?: string;
  activeId?: string;
}

function getSystemInfo(): Promise<CoolinkSystemInfo>;

返回值:

属性类型说明解释
codenumber错误码表示是否发生错误的一个数字,没有错误则为 0
msgstring错误信息文本表示是否发生错误的一个字符串描述,可选
osstring表示系统类型的字符串手机 Android 返回:"android"
手机 iOS 返回:"ios"
Android平板返回:"android-pad"
iPad平板返回:"ios-pad"
酷开系统 TV端返回:"android-ccos-tv"
酷开系统 Pad端返回:"android-ccos-pad"
酷开系统投影仪返回:"android-ccos-projector"
iosVersionstringiOS版本例如:"14.0"
(只有 iOS 下才需要返回此字段)
apiLevelstringAndroid API版本号例如:"31"
(只有 Android 下才需要返回此字段)
deviceIdstring设备ID用于识别当前设备的一个唯一 ID 的字符串
widthnumber屏幕宽度1080
在 UI 编程层面上的一个表示屏幕宽度的值
heightnumber屏幕高度1920
在 UI 编程层面上的一个表示屏幕高度的值
brandstring设备的厂商"Skyworth"
modelstring当前设备的型号"G9300"
panelstring屏幕尺寸"6.0"
macstring当前设备的 MAC 地址"5c862390ae58"
namestring当前设备名称"ZhuXiaoYing's iPhone"
chipstring机芯"8H87"
(仅 TV 端需要返回此值)
activeIdstring激活ID"38134180"
(仅 TV 端需要返回此值)

范例:

import { coolink, Util } from 'coolink';

let sysInfo = await coolink.baseinfo.getSystemInfo();
if (sysInfo.os == 'ios') {
  Util.log('当前系统是 iOS');
} else {
  Util.log('当前系统是 Android');
}

//
Last Updated:
Contributors: liangquanqing, wangyong-debug
©深圳市酷开网络科技股份有限公司 ICP备案号粤ICP备06098778号