2

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?

RedBlueThing
  • 42,006
  • 17
  • 96
  • 122
AlvinfromDiaspar
  • 6,611
  • 13
  • 75
  • 140

7 Answers7

12

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

brendan
  • 29,308
  • 20
  • 68
  • 109
2

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.

Samuel
  • 9,883
  • 5
  • 45
  • 57
1

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

Thanks

Mitesh Khatri
  • 3,935
  • 4
  • 44
  • 67
1

in Android you can get it this way

TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
deviceid = telephonyManager.getDeviceId();
Jay Mayu
  • 17,023
  • 32
  • 114
  • 148
0

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.

Community
  • 1
  • 1
hooked82
  • 6,336
  • 4
  • 41
  • 46
0

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

 NSString *uniqueIdentifier = [[UIDevice currentDevice] uniqueIdentifier];
 NSLog("UniqueIdentifier:-->%@",uniqueIdentifier);
Nikunj Jadav
  • 3,417
  • 7
  • 38
  • 54
0

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