dubrowgn / wattz

An Android battery power status bar indicator
MIT License
187 stars 9 forks source link

Support for android Versions less than 10. #3

Closed Anonymous2716 closed 2 years ago

Anonymous2716 commented 2 years ago

https://github.com/dubrowgn/wattz/blob/637f97a52096b047766bfbae042e64457047ff3f/app/build.gradle#L11

Decrease this minimum SDK version. Its the app I've been looking for a long time. I'm on android 9 . but you're targeting 10 and up. I built your app with min SDK version 25 and it works on my phone. Thanks for your work.

dubrowgn commented 2 years ago

I'm glad you found it useful!

I played around with different sdk versions, and found that [computeChargeTimeRemaining()](https://developer.android.com/reference/android/os/BatteryManager#computeChargeTimeRemaining()) is the newest api, requiring sdk version 28 (Android 9).

$ ./gradlew lint

> Task :app:lintDebug FAILED
Lint found 7 errors, 5 warnings. First failure:

wattz/app/src/main/java/dubrowgn/wattz/Battery.kt:55: Error: Call requires API level 28 (current min is 23):
android.os.BatteryManager#computeChargeTimeRemaining [NewApi]
        val secs = mgr.computeChargeTimeRemaining()
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~
...
dubrowgn commented 2 years ago

Fixed in https://github.com/dubrowgn/wattz/commit/db799dc7ae744959a6f4eb48a106078447926341, and released in https://github.com/dubrowgn/wattz/releases/tag/v1.4. Thanks for the help!

Anonymous2716 commented 2 years ago

@dubrowgn okay. Thanks and take a star ⭐.