说明
使用 chrome.enterprise.deviceAttributes
API 读取设备属性。注意:此 API 仅适用于由企业政策强制安装的扩展程序。
权限
enterprise.deviceAttributes
可用性
方法
getDeviceAnnotatedLocation()
chrome.enterprise.deviceAttributes.getDeviceAnnotatedLocation(
callback?: function,
)
获取管理员注释的位置。如果当前用户未关联或管理员未设置任何“注释位置”,则返回空字符串。
参数
-
callback
函数(可选)
callback
参数如下所示:(annotatedLocation: string)=>void
-
annotatedLocation
string
-
返回
-
Promise<string>
Chrome 96 及更高版本只有 Manifest V3 及更高版本支持 Promise,其他平台需要使用回调。
getDeviceAssetId()
chrome.enterprise.deviceAttributes.getDeviceAssetId(
callback?: function,
)
获取管理员注释的资源 ID。如果当前用户未关联或管理员未设置任何资产 ID,则返回空字符串。
参数
-
callback
函数(可选)
callback
参数如下所示:(assetId: string)=>void
-
assetId
string
-
返回
-
Promise<string>
Chrome 96 及更高版本只有 Manifest V3 及更高版本支持 Promise,其他平台需要使用回调。
getDeviceHostname()
chrome.enterprise.deviceAttributes.getDeviceHostname(
callback?: function,
)
获取根据 DeviceHostnameTemplate 政策设置的设备主机名。如果当前用户不是关联用户或企业政策尚未设置主机名,则返回空字符串。
参数
-
callback
函数(可选)
callback
参数如下所示:(hostname: string)=>void
-
hostname
string
-
返回
-
Promise<string>
Chrome 96 及更高版本只有 Manifest V3 及更高版本支持 Promise,其他平台需要使用回调。
getDeviceSerialNumber()
chrome.enterprise.deviceAttributes.getDeviceSerialNumber(
callback?: function,
)
获取设备的序列号。请注意,此 API 的用途是管理设备(例如,为设备级证书生成证书签名请求)。未经设备管理员同意,不得使用此 API 跟踪设备。如果当前用户未关联,则返回空字符串。
参数
-
callback
函数(可选)
callback
参数如下所示:(serialNumber: string)=>void
-
serialNumber
string
-
返回
-
Promise<string>
Chrome 96 及更高版本只有 Manifest V3 及更高版本支持 Promise,其他平台需要使用回调。
getDirectoryDeviceId()
chrome.enterprise.deviceAttributes.getDirectoryDeviceId(
callback?: function,
)
获取 Directory API 的设备标识符的值(由服务器生成),并标识用于在 Cloud Directory API 中查询的设备的云端记录。如果当前用户未关联,则返回空字符串。
参数
-
callback
函数(可选)
callback
参数如下所示:(deviceId: string)=>void
-
deviceId
string
-
返回
-
Promise<string>
Chrome 96 及更高版本只有 Manifest V3 及更高版本支持 Promise,其他平台需要使用回调。