2015年1月21日星期三

Android Device ID, Device identifier, or unique bundle etc.

What
An unique identifier of device. 

How
  1. There're different methods to fetch an identifier on device, however none of them is perfect. We can use device.mac or secure.id for a lot projects that only available in EU even are limited in some countries, but they could be faked outside EU and in worldwide.
  2. UUID  of Android is almost like its name a "perfect" one, but once you see the doc  from Google, you'll know that it is not the one.
  3. A Gmail(G+ account) could be a candidate for some cases when the client application is under the condition that user must have at least one mail-address.


     
Code
A solution is to merge them first into a class as util. 

Code merge

The method 1. 2. and 3. could be merged into one method. When UUID is "null", the GMAIL should be used, when GMAIL is also "null", the method 1. will be as fallback.

没有评论:

发表评论