Are unique device ids (UDIDs) of Apple's mobile devices (iPhone, iPod touch, et cetera) globally unique even across vendors? Or is it possible some HTC phone has the same id?
This is important for multi-platform apps when you want to filter out duplicated requests on the server side. So the request must be unique acro开发者_高级运维ss platforms and i want to ensure Apple's UDID is enough in this case.
The UDID is a Apple thing... so you won't find it on a HTC phone.
You can calculate it using Python. I don't know where I got the source, but here it is
import hashlib
serial="" #go to your iphones Settings - General -About
imei="" #go to your iphones Settings - General -About
wifi_mac="" #go to your iphones Settings - General -About - Wifi Mac
blue_mac="" #go to your iphones Settings - General -About - Bluetooth Mac
udid=hashlib.sha1(serial.upper()+imei+wifi_mac+blue_mac).hexdigest()
print udid
If you want something unique, I'd suggest you generate and store a uuid on the device on the first run if it's enough for you. (It will change if someone deletes and reinstall the app, but there won't be two devices with the same id)
Perhaps you could pair the UDID with the device MAC, the first 24 bits of which are vendor-specific. You could potentially spoof a MAC on a jailbroken iPhone or rooted Android device, but it could help reduce the likelihood of duplicates.
精彩评论