Skip to content

设备信息模块

点我查看API

集成和使用ESDeviceModule模块。

  • ESDeviceManager是对ESDeviceModule进一步封装。
  • 开发者可以直接使用ESDeviceModule。建议直接使用ESDeviceManager

集成

package.json引入库

点击查看源码
js
"@extscreen/es-core": "^x.x.x"

获取支持的API

示例代码

点击查看源码
js
let androidAPILevel = ESDeviceManager.getAndroidAPILevel();

获取设备内存信息

示例代码

点击查看源码
js
let totalMemory = ESDeviceManager.getDeviceTotalMemory();
let availMemory = ESDeviceManager.getDeviceAvailMemory();

获取设备屏幕信息

示例代码

点击查看源码
js
let screenWidth = ESDeviceManager.getScreenWidth();
let screenHeight = ESDeviceManager.getScreenHeight();

获取设备窗口信息

示例代码

点击查看源码
js
let windowWidth = ESDeviceManager.getWindowWidth();
let windowHeight = ESDeviceManager.getWindowHeight();

获取网络MAC地址

示例代码

点击查看源码
js
let deviceEthMac = ESDeviceManager.getDeviceEthMac();
let deviceWifiMac = ESDeviceManager.getDeviceWifiMac();

获取设备信息

示例代码

点击查看源码
js
let buildManufacturer = ESDeviceManager.getBuildManufacturer();
let buildVersionRelease = ESDeviceManager.getBuildVersionRelease();
let buildModel = ESDeviceManager.getBuildModel();
let buildBrand = ESDeviceManager.getBuildBrand();
let buildDevice = ESDeviceManager.getBuildDevice();
let buildProduct = ESDeviceManager.getBuildProduct();
let buildHardware = ESDeviceManager.getBuildHardware();
let buildSDKVersion = ESDeviceManager.getBuildSDKVersion();
let buildSerial = ESDeviceManager.getBuildSerial();

获取屏幕密度和分辨率相关信息

示例代码

点击查看源码
js
let resolution = ESDeviceManager.getResolution();
let density = ESDeviceManager.getDensity();
let densityDpi = ESDeviceManager.getDensityDpi();
let scaledDensity = ESDeviceManager.getScaledDensity();

获取设备存储空间信息

示例代码

点击查看源码
js
let totalStore = ESDeviceManager.getTotalStore();
let freeStore = ESDeviceManager.getFreeStore();