Skip to content

Commit

Permalink
feat:优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
nestor committed Jul 10, 2023
1 parent f50fe1c commit 68234a3
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,8 @@ class LocationSensorManager : LocationSensorManagerBase() {

if (lastTime != 0L && System.currentTimeMillis() - lastTime < 30000) return
lastTime = System.currentTimeMillis()
canCloseGps = latestContext.getSharedPreferences("config", Context.MODE_PRIVATE)
.getInt("canCloseGps", 0)
checkGps(wifi)
if (canCloseGps > 5) return

Expand Down Expand Up @@ -854,6 +856,8 @@ class LocationSensorManager : LocationSensorManagerBase() {
} else {
canCloseGps = 0
}
latestContext.getSharedPreferences("config", Context.MODE_PRIVATE).edit()
.putInt("canCloseGps", canCloseGps).apply()
}

private fun isUsingWifi(): Boolean {
Expand Down

0 comments on commit 68234a3

Please sign in to comment.