Drop location in tracker service (temp) 3'
This commit is contained in:
parent
055b4c0f5a
commit
4b51b5fdb7
1 changed files with 2 additions and 29 deletions
|
@ -54,34 +54,6 @@ class TelegramLocationProvider(private val app: TelegramApplication) : SensorEve
|
|||
private var agpsDataLastTimeDownloaded: Long = 0
|
||||
private val useMagneticFieldSensorCompass = false
|
||||
|
||||
// note, passive provider is from API_LEVEL 8 but it is a constant, we can check for it.
|
||||
// constant should not be changed in future
|
||||
// LocationManager.PASSIVE_PROVIDER
|
||||
// put passive provider to first place
|
||||
// find location
|
||||
val firstTimeRunDefaultLocation: net.osmand.Location?
|
||||
@SuppressLint("MissingPermission")
|
||||
get() {
|
||||
if (!AndroidUtils.isLocationPermissionAvailable(app)) {
|
||||
return null
|
||||
}
|
||||
val service = app.getSystemService(Context.LOCATION_SERVICE) as LocationManager
|
||||
val ps = service.getProviders(true) ?: return null
|
||||
val providers = ArrayList(ps)
|
||||
val passiveFirst = providers.indexOf("passive")
|
||||
if (passiveFirst > -1) {
|
||||
providers.add(0, providers.removeAt(passiveFirst))
|
||||
}
|
||||
for (provider in providers) {
|
||||
val location = convertLocation(service.getLastKnownLocation(provider))
|
||||
if (location != null) {
|
||||
return location
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
private val gpsListener = object : LocationListener {
|
||||
override fun onLocationChanged(location: Location?) {
|
||||
if (location != null) {
|
||||
|
@ -167,6 +139,7 @@ class TelegramLocationProvider(private val app: TelegramApplication) : SensorEve
|
|||
}
|
||||
|
||||
private fun redownloadAGPS() {
|
||||
/*
|
||||
try {
|
||||
val service = app.getSystemService(Context.LOCATION_SERVICE) as LocationManager
|
||||
service.sendExtraCommand(LocationManager.GPS_PROVIDER, "delete_aiding_data", null)
|
||||
|
@ -178,7 +151,7 @@ class TelegramLocationProvider(private val app: TelegramApplication) : SensorEve
|
|||
agpsDataLastTimeDownloaded = 0L
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
private fun getGpsStatusListener(service: LocationManager): GpsStatus.Listener {
|
||||
|
|
Loading…
Reference in a new issue