问题
public static String getDeviceID(Context mContext) {
String deviceId = Settings.Secure.getString(mContext.getContentResolver(),
Settings.Secure.ANDROID_ID);
return deviceId;
}
This shows a security warning,
"Using 'getString' to get device identifiers is not recommended "
How to resolve this warning?
回答1:
You can't really "resolve" this warning.
Lint is trying to move you from android ID to advertising id if possible, because for most use cases it's better for user. If you want to disable the warning @SuppressLint("HardwareIds")
takes care of that.
来源:https://stackoverflow.com/questions/46321611/alternative-way-removes-security-warning-when-using-android-id-and-how-to-get-th