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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With