2

私はGoogleのライセンスシステムを実装しており、難読化ツールには一意のIDを生成する必要があります。ドキュメントには

/**
 * @param salt an array of random bytes to use for each (un)obfuscation
 * @param applicationId application identifier, e.g. the package name
 * @param deviceId device identifier. Use as many sources as possible to
 *    create this unique identifier.
 */
public AESObfuscator(byte[] salt, String applicationId, String deviceId) {

パッケージ名とデバイスIDに加えて、

private String android_id = Secure.getString(getContext().getContentResolver(),
                                                    Secure.ANDROID_ID); 

他にどのようなソースを使用できますか?

ありがとう

4

1 に答える 1

2

Secure.ANDROID_ID時々nullであることが知られており、root化された電話で変更できると私は信じているので、次のような他のオプションをチェックすることを検討する必要がありますTelephonyManager.getDeviceId()

この質問で見つけた素敵なスニペットは、一意のIDを生成するために次のことを行います。

final TelephonyManager tm = (TelephonyManager) getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);
final String tmDevice, tmSerial, androidId;

tmDevice = "" + tm.getDeviceId();
tmSerial = "" + tm.getSimSerialNumber();
androidId = "" + android.provider.Settings.Secure.getString(getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);

UUID deviceUuid = new UUID(androidId.hashCode(), ((long)tmDevice.hashCode() << 32) | tmSerial.hashCode());
String deviceId = deviceUuid.toString();
于 2012-10-26T14:45:17.357 に答える