Unique ID changed when I changed wifi

Unique ID changed when I changed wifi
5.0 1


There are an problem in Unique ID generate algorithm, when change device’s Wifi, it change Unique ID in my device. So I lost the the Donate License in this case.
Please help me. I cannot connect to admin via Weibo so I post my problem here.

Infact, the unique ID is generated based on IMEI or MEID.
If IMEI or MEID invalid, will generated based on WiFi hardware address and device serial.
Can you tell me your current IMEI?
enter *#06# on the dialpad

public static String getUniqueID(Context ctx) {
    String unique_id = StreamUtils.digest(android.os.Build.getSerial());
    if (CloudUtils.hasTelephony(ctx)) {
        TelephonyManager tm = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);
        for (int slotId = 0; slotId < tm.getSimCount(); slotId++) {
            String imei = tm.getImei(slotId);
            String meid = tm.getMeid(slotId);
            if (CloudUtils.isValid(imei)) {
                return StreamUtils.digest(imei + android.os.Build.getSerial());
            } else if (CloudUtils.isValid(meid)) {
                return StreamUtils.digest(meid + android.os.Build.getSerial());
            }
        }
    } else {
        String wifiInterface = SystemProperties.get("wifi.interface");
        try {
            String wifiMac = new String(NetworkInterface.getByName(wifiInterface).getHardwareAddress());
            unique_id = StreamUtils.digest(wifiMac + android.os.Build.getSerial());
        } catch (Exception ignored) {
        }
    }
    return unique_id;
}

Hmm, Google Pixel C is Tablet without LTE?

Yes, Pixel C dont have LTE,
The last time when I donate to get license, I was connecting my device with a Pocophone’s Hostpot. with that hostpot ,sometimes I dont have get the right unique ID, it is changed when I change my location.
At the present, I am getting a wrong unique id :frowning:
Your ROM for dragon is so great. I hope you can fix that problem.

https://source.android.com/devices/tech/config/immutable-device-ids#restricted-randomized-mac

Restricted device IDs and randomized MAC addresses

To further restrict device IDs, all devices on Android 10 transmit randomized MAC addresses by default for both probe and associated requests, and must have a different randomized MAC address for each SSID. Don’t use the device factory MAC address in client mode, soft access point (AP), or Wi-Fi Direct use cases. It must remain hidden from publicly accessible APIs that aren’t privileged apps. Privileged apps that require the factory MAC address to be returned are required to have LOCAL_MAC_ADDRESS permission.

I have add LOCAL_MAC_ADDRESS permission for MoKeeCenter, it will take effect on next version.
If the unique ID no longer changes, please let me known, I will generate a new license for you.

1 Like

I dont know what next version of Mokee Center is ? I am using the Version 2.5.1.10? Do addition applied ?
If it do, my unique ID now is : 477FD5734EDBD2E2B04AC38FA89A895E
Thank a lot for your quickly respond and your kindness.

2.5.5.10 :slight_smile: after 20191225

I had update my device to the latest version. Please generate new license for my device. The unique ID now is 477FD5734EDBD2E2B04AC38FA89A895E

:smile:You can click restore license option now.

Done. Thank you.

You’re welcome. If it changes again in the future, please let me know and I will try to fix it again.

Today, my unique ID was be changed, so I think the problem is still here. I don’t know what exactly why ? It change between ***895E and ***F5FC even I turn on Wifi or not .

Hmm… Maybe I haven’t solved it, I’ll check it later :rofl: too busy.

I found a new solution, please update to tomorrow’s version and tell me the unique id, thank you.

DDCDD880128C52C5DE66CD77C53AEA61
Here is my new unique id after upgrade to today version.
Hope it don’t change anymore.
Thank a lot for your support

:smiley:Done

Thank you, problem is solved. My unique id isnt changed anymore.
How you solve the problem?
I will donate more for your enthusiastic support.

        String macAddress = Settings.Secure.getString(ctx.getContentResolver(), "bluetooth_address");
        if (!TextUtils.isEmpty(macAddress)) {
            return  StreamUtils.digest(macAddress + android.os.Build.getSerial());
        }

Get MAC addresses in a new way.
bluetooth_address same to wifi mac address.
Just require LOCAL_MAC_ADDRESS permission
:smiley: Thanks for you support.