Android Question [Answered] What Is Best Practice to Get SDK Number?

Jorge M A

Well-Known Member
Licensed User
Longtime User
Hello Everyone!

What is the best practice to get SDK number, considering permissions, library size, performance, etc.?
Reflector or Phone?

B4X:
Sub SDKVersion As Int
    Dim r As Reflector
    Dim ver As Int
    ver = r.GetStaticField("android.os.Build$VERSION", "SDK_INT")
    Return ver
End Sub

B4X:
Sub GetSDK() As Int
    Dim p As Phone
    Return p.SdkVersion
End Sub

(both snippets taken somewhere the forum)

Thank you!
 
Top