Fix sending location right after checkbox switched
This commit is contained in:
parent
fa3917510c
commit
3f52aebedd
3 changed files with 11 additions and 0 deletions
|
@ -127,6 +127,10 @@ class TelegramApplication : Application(), OsmandHelperListener {
|
|||
telegramService?.stopIfNeeded(this, TelegramService.USED_BY_MY_LOCATION)
|
||||
}
|
||||
|
||||
fun forceUpdateMyLocation() {
|
||||
telegramService?.forceLocationUpdate()
|
||||
}
|
||||
|
||||
fun startUserLocationService() {
|
||||
startTelegramService(TelegramService.USED_BY_USERS_LOCATIONS)
|
||||
}
|
||||
|
|
|
@ -130,6 +130,11 @@ class TelegramService : Service(), LocationListener, TelegramIncomingMessagesLis
|
|||
stopForeground(java.lang.Boolean.TRUE)
|
||||
}
|
||||
|
||||
fun forceLocationUpdate() {
|
||||
val location = getFirstTimeRunDefaultLocation()
|
||||
app().shareLocationHelper.updateLocation(location)
|
||||
}
|
||||
|
||||
private fun initLocationUpdates() {
|
||||
val firstLocation = getFirstTimeRunDefaultLocation()
|
||||
app().shareLocationHelper.updateLocation(firstLocation)
|
||||
|
|
|
@ -58,6 +58,8 @@ class ShareLocationHelper(private val app: TelegramApplication) {
|
|||
app.startMyLocationService()
|
||||
|
||||
refreshNotification()
|
||||
} else {
|
||||
app.forceUpdateMyLocation()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue