谁能告诉我android唯一ID即UUID和phonegap设备ID UUID之间的区别?它们是相同的还是不同的值?如果这些值不同,那么两者中是否存在相同的唯一属性值。?
问问题
11035 次
3 回答
7
更新
以上两个参数取值不同,请勿相互匹配。
安卓UUID:
TelephonyManager manager=(TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String uuid=manager.getDeviceId();
android phonegap UUID
-- 返回一个随机的 64 位整数(再次作为字符串!)
--整数在设备第一次启动时生成
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
try {
var uuid = device.uuid; * * //always use device object after deviceready.**
} catch (e) {
alert(e);
}
}
从我的 android(2.3) 手机获得的值是:
安卓 UUID: 354457052232596(16 个数字)
android phonegap UUID:70a0353498a27a34(16 位十六进制数)
更多关于设备 UUID 检查:
http://docs.phonegap.com/en/1.0.0/phonegap_device_device.md.html
于 2013-02-14T19:11:43.143 回答
0
获取设备的通用唯一标识符 (UUID)。
var string = device.uuid;
描述:如何生成 UUID 的详细信息由设备制造商确定,并且特定于设备的平台或型号。
支持的平台:
- 安卓
- BlackBerry WebWorks(OS 5.0 及更高版本)
- 苹果手机
- Windows Phone 7 和 8
- 巴达 1.2 & 2.x
- 网络操作系统
- 蒂岑
- 视窗 8
快速示例
// Android: Returns a random 64-bit integer (as a string, again!)
// The integer is generated on the device's first boot
//
// BlackBerry: Returns the PIN number of the device
// This is a nine-digit unique integer (as a string, though!)
//
// iPhone: (Paraphrased from the UIDevice Class documentation)
// Returns a string of hash values created from multiple hardware identifies.
// It is guaranteed to be unique for every device and cannot be tied
// to the user account.
// Windows Phone 7 : Returns a hash of device+current user,
// if the user is not defined, a guid is generated and will persist until the app is uninstalled
//
// webOS: returns the device NDUID
//
// Tizen: returns the device IMEI (International Mobile Equipment Identity or IMEI is a number
// unique to every GSM and UMTS mobile phone.
var deviceID = device.uuid;
于 2017-04-26T13:09:43.590 回答
-1
我有同样的问题。这是明确的解决方案。
HTML Code:
<!DOCTYPE html>
<html>
<head>
<title>Device Properties Example</title>
<script type="text/javascript" charset="utf-8" src="phonegap-1.0.0.js"></script>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for PhoneGap to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// PhoneGap is ready
//
function onDeviceReady() {
alert("checking...");
var element = document.getElementById('deviceProperties');
element.innerHTML = 'Device Name: ' + device.name + '<br />' +
'Device PhoneGap: ' + device.phonegap + '<br />' +
'Device Platform: ' + device.platform + '<br />' +
'Device UUID: ' + device.uuid + '<br />' +
'Device Version: ' + device.version + '<br />';
}
</script>
</head>
<body>
<p id="deviceProperties">Loading device properties...</p>
</body>
</html>
config.xml look like
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.phonegap.example"
version = "1.0.0"
versionCode = "10" >
<!-- versionCode is optional and Android only -->
<preference name="phonegap-version" value="3.5.0" />
<name>kali</name>
<description>
An example for phonegap build docs.
</description>
<author href="http://yoursite.com" email="you@youremail.com">
Your Name
</author>
<gap:plugin name="org.apache.cordova.device" version="0.2.12" />
</widget>
You have to add cordova.js
its works fine from my side.
于 2014-11-15T06:58:59.233 回答