Check if Android device name is not blank (#1013)

* fix(android): check if device name is not blank

* refactor: use `!isNullOrBlank()`
This commit is contained in:
Jarne Demeulemeester 2024-10-27 16:17:31 +01:00 committed by GitHub
parent 9e66cfa66d
commit eb255a7ae8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,7 +10,7 @@ private fun Context.getDeviceName(): String {
// Use name from device settings
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
val name = Settings.Global.getString(contentResolver, Settings.Global.DEVICE_NAME)
if (name != null) return name
if (!name.isNullOrBlank()) return name
}
// Concatenate the name based on manufacturer and model