Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,10 @@ class BatteryPlusPlugin : MethodCallHandler, EventChannel.StreamHandler, Flutter
}

private fun checkPowerServiceSaveMode(): Boolean {
val powerManager =
applicationContext!!.getSystemService(Context.POWER_SERVICE) as PowerManager
return powerManager.isPowerSaveMode
return applicationContext?.let {
val powerManager = it.getSystemService(Context.POWER_SERVICE) as PowerManager
powerManager.isPowerSaveMode
} ?: false
}

private fun getBatteryProperty(property: Int): Int {
Expand Down
Loading