/OpenUDID

Open source initiative for a universal and persistent UDID solution for Android.

Primary LanguageJava

                                                                                 
     _/_/                                  _/    _/  _/_/_/    _/_/_/  _/_/_/    
  _/    _/  _/_/_/      _/_/    _/_/_/    _/    _/  _/    _/    _/    _/    _/   
 _/    _/  _/    _/  _/_/_/_/  _/    _/  _/    _/  _/    _/    _/    _/    _/    
_/    _/  _/    _/  _/        _/    _/  _/    _/  _/    _/    _/    _/    _/     
 _/_/    _/_/_/      _/_/_/  _/    _/    _/_/    _/_/_/    _/_/_/  _/_/_/        
        _/                                                                       
       _/                                                                        

//  Created by Victor Vieux on 9/9/11.
//  Rewrite by Jason Lam on 22/4/12.
//  Copyright 2012 OpenUDID.net
//
//  iOS / MacOS code: https://github.com/ylechelle/OpenUDID
//  Android code: https://github.com/vieux/OpenUDID
//  Android Alternate code: https://github.com/jasonlamkk/OpenUDID  (no background service, well control of users permission , compatible to IMEI / BT / WIFI methods)
//  .Net / SliverLight code: https://github.com/jasonlamkk/OpenUDID.Net
//
//  Contributors:
//      https://github.com/ylechelle (initiator & iOS code)
//      https://github.com/samrobbins (Mac OS port)
//      https://github.com/vieux (Android version)
//      https://github.com/jasonlamkk (.Net / SliverLight / Android version)

Synopsis: an open source project to provide a universal and persistent
          Unique Device IDentifier (UDID) solution for Android

Major Changes:
 - (*new) added usage of cross-application shared preferences in PackageContext to feature ensuare consistency of UDID
 - make sure the UDID is consistent across application
 - allow using least permission
 - clearly indicate the source of UDID, e.g. IMEI:/WIFIMAC:/BTMAC:/ANDROID:
 - provide enough fail back for Android2.2 device with invalid ANDROID_ID, no phone, no WiFi, no BlueTooth enviroment
 - include a demo project (the project works for android 1.6+ without BT and 2.1+ with BT)
 - add the concept of internal UDID which protect privacy, make it harder for 3rd party to identify your users' devices

Usage:
* in OpenUDID.java , configure the values
	private final static boolean _UseImeiFailback = true;// false if you don't wanna include READ_PHONE_STATE permission
	//we recommend adding BT permission over  READ_PHONE_STATE permission as the will be less privacy concerns
	private final static boolean _UseBlueToothFailback = true; // false if you don't wanna include BT permission or android 1.6
	
* selectively add this to your manifest:

    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<!-- if BlueTooth is used-->    <uses-permission android:name="android.permission.BLUETOOTH"/>
<!-- if IMEI is used-->    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>


* Call void OpenUDID.syncContext(getApplicationContext()); ///to initialize the OpenUDID
// this version is synchronous
* Call `String OpenUDID.getOpenUDIDInContext();` to retrieve your OpenUDID
* Call `String OpenUDID.getCorpUDID(String corpIdentifier);` to retrieve your internal UDID (suggested corpIdentifier can be domain or java package name like com.wavespread)