forked from vieux/OpenUDID
-
Notifications
You must be signed in to change notification settings - Fork 3
/
README
53 lines (44 loc) · 3.15 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
_/_/ _/ _/ _/_/_/ _/_/_/ _/_/_/
_/ _/ _/_/_/ _/_/ _/_/_/ _/ _/ _/ _/ _/ _/ _/
_/ _/ _/ _/ _/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
_/_/ _/_/_/ _/_/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/_/_/
_/
_/
// 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)