Packagecom.myflashlab.air.extensions.udid
Classpublic class UDID
InheritanceUDID Inheritance Object

This ANE will help you get unique device identifiers using Android/iOS APIs. For the iOS side, you have the vendorId property but for the Android side, there are a few properties each returning a different identifier. Some of them might be null on different devices/occasions. Read this blog to learn more about them: http://www.myflashlabs.com/get-adobe-air-unique-device-id/



Public Properties
 PropertyDefined By
  androidId : String
[static] [read-only] On Android, A 64-bit number (as a hex string) that is randomly generated when the user first sets up the device and should remain constant for the lifetime of the user's device.
UDID
  OS : String
[static] [read-only] Indicates the running OS of your device.
UDID
  serialNumber : String
[static] [read-only] On Android, A hardware serial number, if available.
UDID
  telephonyManagerDeviceId : String
[static] [read-only] On Android, Returns the unique device ID, for example, the IMEI for GSM and the MEID or ESN for CDMA phones.
UDID
  telephonyManagerSubscriberId : String
[static] [read-only] On Android, Returns the unique subscriber ID, for example, the IMSI for a GSM phone.
UDID
  UUID : String
[static] [read-only] On Android, UUID is an immutable representation of a 128-bit universally unique identifier (UUID).
UDID
  vendorId : String
[static] [read-only] On iOS, An alphanumeric string that uniquely identifies a device to the app's vendor.
UDID
Public Methods
 MethodDefined By
  
init():void
[static] To use this extension, you must first initialize it with this method.
UDID
  
[static] On Android, Initializes the TelephonyManager class.
UDID
  
retriveAdId($onResult:Function):void
[static] On iOS and Android, Retrieves the advertising ID and indicates whether the user has limited ad tracking or not.
UDID
Public Constants
 ConstantDefined By
  ANDROID : String = android
[static]
UDID
  EXTENSION_ID : String = com.myflashlab.air.extensions.udid
[static]
UDID
  IOS : String = ios
[static]
UDID
  VERSION : String = 2.0.4
[static]
UDID
Property Detail
androidIdproperty
androidId:String  [read-only]

On Android, A 64-bit number (as a hex string) that is randomly generated when the user first sets up the device and should remain constant for the lifetime of the user's device. The value may change if a factory reset is performed on the device.

Note: When a device has multiple users (available on certain devices running Android 4.2 or higher), each user appears as a completely separate device, so the UDID.androidId value is unique to each user.


Implementation
    public static function get androidId():String
OSproperty 
OS:String  [read-only]

Indicates the running OS of your device.


Implementation
    public static function get OS():String
serialNumberproperty 
serialNumber:String  [read-only]

On Android, A hardware serial number, if available. Alphanumeric only, case-insensitive.


Implementation
    public static function get serialNumber():String
telephonyManagerDeviceIdproperty 
telephonyManagerDeviceId:String  [read-only]

On Android, Returns the unique device ID, for example, the IMEI for GSM and the MEID or ESN for CDMA phones. Return null if device ID is not available.


Implementation
    public static function get telephonyManagerDeviceId():String
telephonyManagerSubscriberIdproperty 
telephonyManagerSubscriberId:String  [read-only]

On Android, Returns the unique subscriber ID, for example, the IMSI for a GSM phone. Return null if it is unavailable.


Implementation
    public static function get telephonyManagerSubscriberId():String
UUIDproperty 
UUID:String  [read-only]

On Android, UUID is an immutable representation of a 128-bit universally unique identifier (UUID). This property returns a variant 2, version 4 (randomly generated number) UUID as per RFC 4122.


Implementation
    public static function get UUID():String
vendorIdproperty 
vendorId:String  [read-only]

On iOS, An alphanumeric string that uniquely identifies a device to the app's vendor. The value of this property is the same for apps that come from the same vendor running on the same device. A different value is returned for apps on the same device that come from different vendors, and for apps on different devices regardless of vendor. Normally, the vendor is determined by data provided by the App Store. If the app was not installed from the app store (such as enterprise apps and apps still in development), then a vendor identifier is calculated based on the app's bundle ID.


Implementation
    public static function get vendorId():String
Method Detail
init()method
public static function init():void

To use this extension, you must first initialize it with this method.

initTelephonyManager()method 
public static function initTelephonyManager():void

On Android, Initializes the TelephonyManager class.

retriveAdId()method 
public static function retriveAdId($onResult:Function):void

On iOS and Android, Retrieves the advertising ID and indicates whether the user has limited ad tracking or not. Unlike the vendorId property for iOS, the same value is returned to all vendors. This identifier may change—for example, if the user erases the device—so you should not cache it. In iOS 10.0 and later, the value of adId is all zeroes when the user has limited ad tracking. If the value is null, wait and get the value again later.

Parameters

$onResult:Function


Example
The following example will tell you how to call this method and retrive the adId:
         UDID.retriveAdId(onResult);
         
         function onResult($id:String, $isLimitAdTrackingEnabled:Boolean):void
         {
             trace("ad ID = " + $id);
             trace("isLimitAdTrackingEnabled = " + $isLimitAdTrackingEnabled);
         }
         
Constant Detail
ANDROIDConstant
public static const ANDROID:String = android

EXTENSION_IDConstant 
public static const EXTENSION_ID:String = com.myflashlab.air.extensions.udid

IOSConstant 
public static const IOS:String = ios

VERSIONConstant 
public static const VERSION:String = 2.0.4