首页 技术 正文
技术 2022年11月8日
0 收藏 359 点赞 1,353 浏览 1643 个字

一、 获取设备信息的方法列表(如果没有或者检测不出来就显示undefined)

  1、device.name              设备名称(一些国产机检测不出来)

  2、device.model     :返回设备的模型或产品的名称

  3、device.cordova           PhoneGap 版本

  4、device.platform         设备平台

  5、device.uuid               uuid 编码(这个编码是设备的唯一编码相当于每部手机的身份证,比较常用,项目中就可以通过这个编码跟用户的id进行绑定)

  6、device.version           平台版本

二、代码实现

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>phonegap_device_network_notification01</title>
<link href="../jquery.mobile-1.3.2.css" rel="external nofollow" rel="stylesheet" type="text/css"/>
<script src="../jquery.js" type="text/javascript"></script>
<script src="../jquery.mobile-1.3.2.js" type="text/javascript"></script>
<script src="../cordova.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
document.addEventListener("deviceready", myDeviceReadyListener, false);
}); function myDeviceReadyListener(){
$("#deviceName .ui-btn-text").text("设备名称" + device.name);
$("#deviceModel .ui-btn-text").text("设备的模型" + device.model);
$("#deviceCordova .ui-btn-text").text("PhoneGap版本" + device.cordova);
$("#devicePlatform .ui-btn-text").text("设备平台" + device.platform);
$("#deviceUUID .ui-btn-text").text("uuid编码" + device.uuid);
$("#deviceVersion .ui-btn-text").text("平台版本" + device.version);
} </script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>PhoneGap实战</h1>
</div>
<div data-role="content">
<a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" data-role="button" id="deviceName"></a>
<a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" data-role="button" id="deviceModel"></a>
<a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" data-role="button" id="deviceCordova"></a>
<a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" data-role="button" id="devicePlatform"></a>
<a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" data-role="button" id="deviceUUID"></a>
<a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" data-role="button" id="deviceVersion"></a>
</div>
<div data-role="footer">
<h4>&nbsp;</h4>
</div>
</div>
</body>
</html>
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,492
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,907
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,740
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,493
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,132
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,295