Skip to content

Instantly share code, notes, and snippets.

@seventhmoon
Created January 17, 2024 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seventhmoon/d1df18a281c0fdeef6d2b03465a28dc4 to your computer and use it in GitHub Desktop.
Save seventhmoon/d1df18a281c0fdeef6d2b03465a28dc4 to your computer and use it in GitHub Desktop.
BuildIdHelper to get the QPR version information
import android.os.Build
//Ref: https://source.android.com/docs/setup/reference/build-numbers#build-ids-defined
object BuildHelper {
fun getQprNumber(): Int {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return 0
else {
when (Build.ID.substring(1, 2)) {
"P", "D" -> return 0
"Q" -> return Build.ID.substring(2, 3).toInt()
}
}
return -1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment