Device Information
Device Information
Importing Modules
import device from '@system.device'
Developers need to declare the application's access permission for watch.permission.DEVICE_INFO in the manifest.json file.
API Definitions
getInfo
Get basic information about the device. The meanings of the property fields in the returned object are:
brand: Device brand name.manufacturer: Device manufacturer.model: Device model.product: Device product code.osType: Operating system name.osVersionName: Operating system version name.brand: Device brand name.brand: Device brand name.brand: Device brand name.
getId
Batch get device identification information. The types parameter specifies the categories of information to retrieve, which is an Array object composed of 'device', 'mac', 'user', or 'advertising' elements. Depending on the value of types, the meanings of the fields in the returned object's properties are:
type: .device: Unique device identifier, exists only whentypescontains the'device'element.mac: MAC address of the device, exists only whentypescontains the'mac'element.user: Unique user identifier, exists only whentypescontains the'user'element.advertising: Unique advertising identifier, exists only whentypescontains the'advertising'element.
getDeviceId
Gets the unique device identifier.
getSerial
Gets the device serial number.
getTotalStorage
Gets the total size of the storage space, in bytes.
getAvailableStorage
Gets the available size of the storage space, in bytes.
Tips
On the emulator, the values returned by the getTotalStorage() and getAvailableStorage() methods may be inaccurate and will not change as the storage space changes.
screenWidth
The screen width of the device, in pixels.
screenHeight
The screen height of the device, in pixels.
screenDensity
The screen pixel density of the device, in .
screenShape
The screen shape of the device. The values are as follows:
'rect': The device has a rectangular screen.'circle': The device has a circular screen.
memoryProfile
Gets the memory profile attribute of the device. This attribute is the JavaScript API version of the memory-profile media query attribute. For details, please refer to the documentation for media query attributes.
Unlike the memory-profile media query attribute, the value of the memoryProfile attribute is an integer, and the unit is fixed as .
