Ignore exception without permission

This commit is contained in:
Milos Kozak 2022-01-17 09:21:14 +01:00
parent b29d45de4b
commit 4fb1704912

View file

@ -110,7 +110,11 @@ class ImportExportPrefsImpl @Inject constructor(
// based on https://medium.com/@pribble88/how-to-get-an-android-device-nickname-4b4700b3068c // based on https://medium.com/@pribble88/how-to-get-an-android-device-nickname-4b4700b3068c
val n1 = Settings.System.getString(context.contentResolver, "bluetooth_name") val n1 = Settings.System.getString(context.contentResolver, "bluetooth_name")
val n2 = Settings.Secure.getString(context.contentResolver, "bluetooth_name") val n2 = Settings.Secure.getString(context.contentResolver, "bluetooth_name")
val n3 = (context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter?.name val n3 = try {
(context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter?.name
} catch (e: Exception){
null
}
val n4 = Settings.System.getString(context.contentResolver, "device_name") val n4 = Settings.System.getString(context.contentResolver, "device_name")
val n5 = Settings.Secure.getString(context.contentResolver, "lock_screen_owner_info") val n5 = Settings.Secure.getString(context.contentResolver, "lock_screen_owner_info")
val n6 = Settings.Global.getString(context.contentResolver, "device_name") val n6 = Settings.Global.getString(context.contentResolver, "device_name")