diff --git a/play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/AdvertiserService.kt b/play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/AdvertiserService.kt index 03612f2a..6b894642 100644 --- a/play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/AdvertiserService.kt +++ b/play-services-nearby-core/src/main/kotlin/org/microg/gms/nearby/exposurenotification/AdvertiserService.kt @@ -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) }