2011-08-19 67 views

回答

12

我不相信有,甚至可能是一個跨平臺的方式做到這一點。每個設備都有自己的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

1

嘗試獲取IMEI號碼。可能會對你有用。

感謝

2

,如果你是不屑大約只有移動設備,那麼有一些所謂的IMEI numner。這應該是可訪問的。法律含義我不確定。我想,只要你不會太個人化(標籤給一個人),這應該不成問題。

1

Android中你可以得到這樣

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

對於iPhone 您將在iPhone上使用下面的代碼找到移動設備ID。

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

這是我如何做到這一點的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); 
      } 

    } 

是保持他們的電話號碼,據我所知,微軟的自動顯示與響應的協議用戶,他們發現了什麼該應用程序需要使用,

您可以向用戶展示某種EULA,當他們啓動應用程序時詢問他們是否允許使用他們的電話號碼

相關問題