I currently have code that gets the device identifier (advertising ID) on Google Play enabled and Kindle devices. Now I'm looking for documentation targeting developers that would explain how to get it on other Android forks (similar to Amazon's instructions), esp. on Xiaomi and Alibaba phones made for the local Chinese market.
One resource I could find is by AppsFlyer which is obviously bogus since it states "IMEI and Android ID - Both are necessary for accurate attribution" while the former is disabled since Android 6 (unless you want to prompt the user for a runtime permission) besides other problems with it and the latter is not device unique since Oreo.
This isn't the answer I was hoping for, but after further research, the "first and largest independent mobile advertising platform of China", Youmi, does have an open source DeviceInfoUtils
class and they do everything AppsFlyer recommended, that is, everything Google is against.
To be specific, with every request, they send: telephonyManager.getDeviceId();
(IMEI on GSM phones), telephonyManager.getSubscriberId()
(IMSI on GSM phones), the MAC address, and the ANDROID_ID
. Again, the first two of these require prompting the user for allowing the app to "make and manage phone calls" which is super creepy (resulting in bad app ratings and/or denied permissions). The latter two of these used to work but as of Oreo, they are not device unique any more as I mentioned in my question statement.
Update: I have now downloaded Xiaomi's Mimo SDK (ads SDK). Decompiling reveals a class called AdvertisingIdHelper
which has only two methods, one to check if the device has Google Play store installed, and the other looks like this:
private static d z(Context paramContext)
{
if (!y(paramContext)) {
return null;
}
try {
d localD = new d();
Intent localIntent = new Intent("com.google.android.gms.ads.identifier.service.START");
localIntent.setPackage("com.google.android.gms");
if (paramContext.bindService(localIntent, localD, 1))
return localD;
} catch (SecurityException localSecurityException) {
com.miui.zeus.a.a.b("stacktrace_tag", "stackerror:", localSecurityException);
return null;
}
return null;
}
What its role is in the overall SDK is unclear but it definitely seems like a way of querying Google's ads ID rather than Xiaomi's alternative ID. If this is for all cases, or only for devices sold outside of China (which does have Google Play services) is again unclear.