How to discover android version programmatically?

Asked

Viewed 60 times

2

I’m new in android and I need to get the version of Android Device in a direct way, without having to consult, for example:
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR1)

Has as?

  • 1

    And why can’t you use Build.VERSION.SDK_INT?

  • @Guilhermenascimento unless the AP, instead of the number, wants the name(HONEYCOMB_MR1)

  • Try Context.getApplicationInfo()

  • 1

    @ramaral yes I thought about it because if this is maybe a list would already solve, but I don’t know if he wants the code name or if he wants to create fallback codes for older versions.

  • I apologize to everyone. I was away for a while and I couldn’t get into this space. My problem is the following: I have a Samsung phone with the android version "Lolipop" 5.0.2. My wife also owns the same phone, however, purchased more recent and has the version "Lolipop" is 5.1.1. My App cannot read this version, since, using "Build.VERSION.SDK_INT", the most I can see is version 5.0.2 (M).

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.