gpt4 book ai didi

iphone - 有没有一种编程方式来获取移动设备的唯一标识符?

转载 作者:太空狗 更新时间:2023-10-29 15:32:08 24 4
gpt4 key购买 nike

我需要一种方法来了解每个用户的唯一性,无论是针对 iPhone、Android 还是 Windows Phone 设备。如果没有通用的方法,我想知道保存电话号码是否合法(即合法)。

谁有这方面的经验?

最佳答案

我不相信有,甚至不可能有跨平台的方式来做到这一点。每个设备都有自己的 SDK 平台和 API。

更新:对我之前的声明稍作更正,看起来像 PhoneGap也许能够为您提供跨平台方法。

PhoneGap:

var deviceID = device.uuid;

参见:http://docs.phonegap.com/phonegap_device_device.md.html

以下是您可以在每个平台上执行此操作的方法:

安卓:

android.telephony.getDeviceId()

参见:http://developer.android.com/reference/android/telephony/TelephonyManager.html#getDeviceId%28%29

iPhone:

[[UIDevice currentDevice] uniqueIdentifier]

参见:http://developer.apple.com/library/ios/#documentation/uikit/reference/UIDevice_Class/Reference/UIDevice.html

Windows Phone 7:

DeviceExtendedProperties.GetValue("DeviceUniqueId")

参见:http://msdn.microsoft.com/en-us/library/ff941122%28v=VS.92%29.aspx

黑莓:

FindDeviceForUserResult result=coreWebService.findDeviceForUser(userId, locale, true);
if (result.getFindDeviceForUserReturnStatus().getCode()!= FindDeviceForUserReturnStatusEnumType.SUCCESS)
{
// handle any errors
}
if (result.getDevice() == null)
{
// notify the user
}
int deviceID = result.getDevice().getDeviceId();

参见:http://docs.blackberry.com/en/developers/deliverables/7283/Find_BlackBerry_devices_628863_11.jsp

关于iphone - 有没有一种编程方式来获取移动设备的唯一标识符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7117562/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com