I'm beginner of android app development. I have an android app with dark mode in it and the dark mode does not work for android version below 8. So i want to add a code which detects the android version of the phone and gives a toast msg or disables the switch which toggles dark mode. So how can i make it?
Asked
Active
Viewed 56 times
1
-
https://stackoverflow.com/questions/3093365/how-can-i-check-the-system-version-of-android – Dominik Wuttke Apr 14 '21 at 16:01
1 Answers
0
You can use the Build.VERSION
class
val release = Build.VERSION.RELEASE //Version 11
val sdkVersion = Build.VERSION.SDK_INT //30
Toast.makeText(this, "Version:$release SDK:$sdkVersion",Toast.LENGTH_LONG).show()

Gabriele Mariotti
- 320,139
- 94
- 887
- 841