Answer the question
In order to leave comments, you need to log in
What is the best way to get the 3 byte device id?
The task requires a 3-byte identifier. It is clear that there will be no special uniqueness, but I would like to squeeze the maximum.
Now I use the last 3 bytes of the MAC address for this, but Google does not like it.
From ideas: choose one of the available identifiers and use sum24 on it.
Answer the question
In order to leave comments, you need to log in
You can take the first byte from the device id, from the middle and the last byte:
String uuid = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
byte[] bytes = uuid.getBytes();
byte[] id = new byte[] {bytes[0], bytes[bytes.length / 2], bytes[bytes.length - 1]};
An idea based on the experience of a program that tried to squeeze at least some iron UID out of the zoo of android devices even before Google did it out of the box. We took tablet identifiers, IMEI phones, MAC ... A bunch of hemorrhoids with cheap Chinese, in which the same IMEI returns an arbitrary one of two SIM cards, for example.
Just generate a random number and store it with the program. Anyone who wants to hack will dig anyway. But on a fenced Android, this can be simply neglected.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question