diff --git a/vector/src/main/java/im/vector/app/features/location/LocationSharingService.kt b/vector/src/main/java/im/vector/app/features/location/LocationSharingService.kt index 9b3a1432de..0515947474 100644 --- a/vector/src/main/java/im/vector/app/features/location/LocationSharingService.kt +++ b/vector/src/main/java/im/vector/app/features/location/LocationSharingService.kt @@ -169,21 +169,16 @@ class LocationSharingService : VectorService(), LocationTracker.Callback { private fun tryToDestroyMe() { if (roomArgsMap.isEmpty()) { Timber.i("### LocationSharingService. Destroying self, time is up for all rooms") - destroyMe() + stopSelf() } } - private fun destroyMe() { - jobs.forEach { it.cancel() } - jobs.clear() - locationTracker.removeCallback(this) - stopSelf() - } - override fun onDestroy() { super.onDestroy() Timber.i("### LocationSharingService.onDestroy") - destroyMe() + jobs.forEach { it.cancel() } + jobs.clear() + locationTracker.removeCallback(this) } private fun addRoomArgs(beaconEventId: String, roomArgs: RoomArgs) {