mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 19:36:08 +03:00
Avoid stopping location service twice
This commit is contained in:
parent
353a8a70eb
commit
3b09323ee4
1 changed files with 4 additions and 9 deletions
|
@ -169,21 +169,16 @@ class LocationSharingService : VectorService(), LocationTracker.Callback {
|
||||||
private fun tryToDestroyMe() {
|
private fun tryToDestroyMe() {
|
||||||
if (roomArgsMap.isEmpty()) {
|
if (roomArgsMap.isEmpty()) {
|
||||||
Timber.i("### LocationSharingService. Destroying self, time is up for all rooms")
|
Timber.i("### LocationSharingService. Destroying self, time is up for all rooms")
|
||||||
destroyMe()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun destroyMe() {
|
|
||||||
jobs.forEach { it.cancel() }
|
|
||||||
jobs.clear()
|
|
||||||
locationTracker.removeCallback(this)
|
|
||||||
stopSelf()
|
stopSelf()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
Timber.i("### LocationSharingService.onDestroy")
|
Timber.i("### LocationSharingService.onDestroy")
|
||||||
destroyMe()
|
jobs.forEach { it.cancel() }
|
||||||
|
jobs.clear()
|
||||||
|
locationTracker.removeCallback(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addRoomArgs(beaconEventId: String, roomArgs: RoomArgs) {
|
private fun addRoomArgs(beaconEventId: String, roomArgs: RoomArgs) {
|
||||||
|
|
Loading…
Reference in a new issue