also catch potential stopAdvertising exceptions

This commit is contained in:
Marcus Hoffmann 2021-11-25 15:34:19 +01:00 committed by Marvin W
parent 88d14e9e8a
commit 10455df7e2

View File

@ -218,7 +218,11 @@ class AdvertiserService : LifecycleService() {
Log.i(TAG, "Tried calling stopAdvertisingSet without android.permission.BLUETOOTH_ADVERTISE permission.", )
}
} else {
advertiser?.stopAdvertising(callback)
try {
advertiser?.stopAdvertising(callback)
} catch (e: SecurityException) {
Log.i(TAG, "stopAdvertising() failed with a SecurityException. Maybe some permissions are missing?", )
}
}
handler.postDelayed(startLaterRunnable, 1000)
}