Android Question {Solved} Android OS version

Alex_197

Well-Known Member
Licensed User
Longtime User
Hi to all.

Is it possible to check what is Android OS version on the device where the app is running?

I tried to check Phone library but all I found is SDK version that has nothing to do with OS version. The same app with targetSDK=29 can be installed on Android 4,7,9, 10 but I need to know what current OS version.

Thanks
 
Last edited:

aeric

Expert
Licensed User
Longtime User
B4X:
Sub Process_Globals
    Private NativeMe As JavaObject
End Sub

Sub Globals

End Sub

Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then
        NativeMe.InitializeContext
    End If
    Dim s As String = NativeMe.RunMethod("getAndroidVersion", Null)
    Log(s)
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

#If JAVA
public String getAndroidVersion() {
    String release = android.os.Build.VERSION.RELEASE;
    int sdkVersion = android.os.Build.VERSION.SDK_INT;
    return "Android SDK: " + sdkVersion + " (" + release +")";
} 
#End If

Reference:
https://stackoverflow.com/questions/3093365/how-can-i-check-the-system-version-of-android
 
Upvote 0

Alex_197

Well-Known Member
Licensed User
Longtime User
B4X:
Sub Process_Globals
    Private NativeMe As JavaObject
End Sub

Sub Globals

End Sub

Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then
        NativeMe.InitializeContext
    End If
    Dim s As String = NativeMe.RunMethod("getAndroidVersion", Null)
    Log(s)
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

#If JAVA
public String getAndroidVersion() {
    String release = android.os.Build.VERSION.RELEASE;
    int sdkVersion = android.os.Build.VERSION.SDK_INT;
    return "Android SDK: " + sdkVersion + " (" + release +")";
}
#End If

Reference:
https://stackoverflow.com/questions/3093365/how-can-i-check-the-system-version-of-android
Thanks a lot:)
 
Upvote 0
Top