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>;
返回值:
| 属性 | 类型 | 说明 | 解释 |
|---|---|---|---|
| code | number | 错误码 | 表示是否发生错误的一个数字,没有错误则为 0 |
| msg | string | 错误信息文本 | 表示是否发生错误的一个字符串描述,可选 |
| os | string | 表示系统类型的字符串 | 手机 Android 返回:"android" 手机 iOS 返回:"ios" Android平板返回:"android-pad" iPad平板返回:"ios-pad" 酷开系统 TV端返回:"android-ccos-tv" 酷开系统 Pad端返回:"android-ccos-pad" 酷开系统投影仪返回:"android-ccos-projector" |
| iosVersion | string | iOS版本 | 例如:"14.0" (只有 iOS 下才需要返回此字段) |
| apiLevel | string | Android API版本号 | 例如:"31" (只有 Android 下才需要返回此字段) |
| deviceId | string | 设备ID | 用于识别当前设备的一个唯一 ID 的字符串 |
| width | number | 屏幕宽度 | 1080 在 UI 编程层面上的一个表示屏幕宽度的值 |
| height | number | 屏幕高度 | 1920 在 UI 编程层面上的一个表示屏幕高度的值 |
| brand | string | 设备的厂商 | "Skyworth" |
| model | string | 当前设备的型号 | "G9300" |
| panel | string | 屏幕尺寸 | "6.0" |
| mac | string | 当前设备的 MAC 地址 | "5c862390ae58" |
| name | string | 当前设备名称 | "ZhuXiaoYing's iPhone" |
| chip | string | 机芯 | "8H87" (仅 TV 端需要返回此值) |
| activeId | string | 激活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');
}
//
©深圳市酷开网络科技股份有限公司 ICP备案号粤ICP备06098778号
