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

发布于 2024-11-30 03:48:26 字数 115 浏览 6 评论 0原文

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

有人有这方面的经验吗?

I need a way to know the uniqueness per user, whether it be for iPhone, Android, or Windows Phone devices. If there is no universal way, i was wondering if saving the phone number would be legitimate (i.e. legal).

Anybody have any experience in this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

乞讨 2024-12-07 03:48:26

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

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

PhoneGap:

var deviceID = device.uuid;

请参阅:http://docs.phonegap.com/phonegap_device_device。 md.html

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

Android:

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

I don't believe there is, or even could be, a cross platform way to do this. Each device has it's own SDK platform and API's.

UPDATE: Slight correction on my previous statement as it looks like PhoneGap may be able to give you a cross platform approach.

PhoneGap:

var deviceID = device.uuid;

See: http://docs.phonegap.com/phonegap_device_device.md.html

Here's how you could do it on each platform:

Android:

android.telephony.getDeviceId()

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

iPhone:

[[UIDevice currentDevice] uniqueIdentifier]

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

Windows Phone 7:

DeviceExtendedProperties.GetValue("DeviceUniqueId")

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

Blackberry:

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();

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

并安 2024-12-07 03:48:26

如果您只关心移动设备,那么有一个叫做 IMEI 号码的东西。应该是可以访问的。法律含义我不确定。我想只要你不变得太个人化(标记一个人),这应该不是问题。

if you are bothered about only mobile devices, then there is something called IMEI numner. which should be accessible. legal implication im not sure. i guess as long as you don't get too personal (tagging to a person), it shouldn't be a problem.

绅刃 2024-12-07 03:48:26

尝试获取 IMEI 号码。也许它会对你有用。

谢谢

try to get IMEI number. may be it will useful for you.

Thanks

如若梦似彩虹 2024-12-07 03:48:26

在Android中你可以这样得到它

TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
deviceid = telephonyManager.getDeviceId();

in Android you can get it this way

TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
deviceid = telephonyManager.getDeviceId();
黑凤梨 2024-12-07 03:48:26

我无法代表 iPhone 或 Windows Phone 7,但要获取 Android 手机的唯一 ID,我建议查看这篇文章:

是否有唯一的 Android 设备 ID?

如前所述,它不是 100% 可靠。

I can't speak for iPhone or Windows Phone 7, but to get the Unique ID of an Android phone, I'd suggest looking at this post:

Is there a unique Android device ID?

As noted, it's not 100% reliable.

枯寂 2024-12-07 03:48:26

适用于iPhone
您将在 iPhone 中使用以下代码找到移动设备 ID。

 NSString *uniqueIdentifier = [[UIDevice currentDevice] uniqueIdentifier];
 NSLog("UniqueIdentifier:-->%@",uniqueIdentifier);

For iPhone
You will find mobile device id using following code in iPhone.

 NSString *uniqueIdentifier = [[UIDevice currentDevice] uniqueIdentifier];
 NSLog("UniqueIdentifier:-->%@",uniqueIdentifier);
夜光 2024-12-07 03:48:26

这就是我为 WindowsPhone 保留电话号码的方式

 void checkGuid()
    {
            object uniqueID;
            DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueID);
            byte[] bID = (byte[])uniqueID;
            _clientID = Convert.ToBase64String(bID);
            Debug.WriteLine(_clientID);
            if (!IsolatedStorageSettings.ApplicationSettings.Contains("Guid"))
            {
                IsolatedStorageSettings.ApplicationSettings.Add("Guid", _clientID);
            }

    }

,据我所知,Microsoft 自动向用户提供协议,以响应他们检测到应用程序需要使用的内容,

您可以向用户提供 EULA当他们启动应用程序时,要求他们获得使用电话号码的许可

this is how I do it for WindowsPhone

 void checkGuid()
    {
            object uniqueID;
            DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueID);
            byte[] bID = (byte[])uniqueID;
            _clientID = Convert.ToBase64String(bID);
            Debug.WriteLine(_clientID);
            if (!IsolatedStorageSettings.ApplicationSettings.Contains("Guid"))
            {
                IsolatedStorageSettings.ApplicationSettings.Add("Guid", _clientID);
            }

    }

as for keeping their phone number, as far as I am aware of Microsoft automatically present the user with an agreement in response to what they detected the app needs to use,

You can present the Users with an EULA of some sort when they launch the app that asks them for permission to use their phone number

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文