Using 'getString' to get device identifiers is not recommended

Kotlin code:
@JvmStatic
    val udid: String?
        get() {
            try {
                return Settings.Secure.getString(MyApplication.get().contentResolver, Settings.Secure.ANDROID_ID)
            } catch (e: Exception) {
                e.fillInStackTrace()
            }

            return null

        }

Android Java code:
String deviceID = Settings.Secure.getString(getApplicationContext().getContentResolver(),
        Settings.Secure.ANDROID_ID);

Best References:
https://stackoverflow.com/questions/47691310/why-is-using-getstring-to-get-device-identifiers-not-recommended
https://developer.android.com/training/articles/user-data-ids.html

No comments:

Post a Comment

Popular Posts