1.安装
cordova plugin add cordova-plugin-device
2. 添加按钮
<button id="device">获取设备信息</button>
3.
document.addEventListener('deviceReady',function(){
document.getElementById('device').onclick=function(){
alert("获取设备运行的cordova版本:"+device.cordova)
alert("设备是否运行在模拟器上:"+device.isVirtual)
alert("获取设备制造商:"+device.manufacturer)
alert("获取设备型号或产品的名称:"+device.model)
alert("获取设备操作系统名称:"+device.platform)
alert("获取设备的硬件序列号:"+device.serial)
alert("获取设备唯一标识符:"+device.uuid)
alert("获取操作系统的版本:"+device.version)
}
})
这篇博客详细介绍了如何在Cordova项目中安装和使用设备信息插件,包括安装步骤和添加操作按钮的实践教程。

1万+

被折叠的 条评论
为什么被折叠?



