Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Return Android OS name [duplicate]

Tags:

java

android

I was wondering how I could go about returning the name of the Android OS version (i.e. KitKat, JellyBean, etc) programatically. I'm able to find just about everything about the OS except the "codename", if you will. Any help is welcome, thanks.

like image 616
ArmaAK Avatar asked May 10 '26 20:05

ArmaAK


1 Answers

I played around with an answer from the suggested question, found here, and came up with this one liner that returns the "codename" of the currently running OS version:

Build.VERSION_CODES.class.getFields()[android.os.Build.VERSION.SDK_INT].getName();
like image 71
ArmaAK Avatar answered May 12 '26 10:05

ArmaAK