Search code examples
androidiphoneudid

Iphone UDID and Android ID


I'm wondering if there is any distinctive difference between Iphone UDID's and an Android ID's?

Do the Iphone UDID's consist of a different amount of numbers/characters as opposed to the Android ID's? Is there any other distinguishing differences allowing a formula to tell the difference between an Iphone UDID and an Android ID?

I'm building an SQL database and want to be able to sort through the stored ID's and be able to determine whether the ID is for an Android or Iphone (without the addition of another database field).

Cheers,


Solution

  • First of all the UDID on IOS is deprecated since IOS 5 and you shouldn't use it. You can use the CFUUIDCreate function to generate one. But with this method you get a new udid with each install. So if the user remove your app and install it again later, you will get a new udid.

    With this method an IOS UDID will have the format like E8AB292E-C980-4DA7-8B88-D11F11F11E11

    An android udid is unique, even if your user desinstall/re-install your app. Its format is different from IOS. It looks like 012790000791234 or A100000BD11B1E, so you can make a small regex to check the difference since its shorter and doesn't seem to include a "-" but it could be weak for the futur (specially if you plan to add more platform).

    But since you know on wich kind of device your app is build for you could just set a flag "platform" and set its value to IOS or Android. (Wich let open the space to add more platform later like windows, blackberry).