Android Question Can I Get The Device Architecture 32bit/64bit?

aidymp

Well-Known Member
Licensed User
Longtime User
Hi! Can I get the device architecture eg, 32bit/64bit? I have searched the forum and even the promising EasyDeviceInfo did not seem to help. I just want a simple is64bit or similar.

Thanks

Aidy
 

JordiCP

Expert
Licensed User
Longtime User
This should work
B4X:
Sub is64 As Boolean

    Dim JO As JavaObject
    JO.InitializeStatic("android.os.Build")
    Dim p As Phone
    If p.SdkVersion<21 Then
        Dim OO As String = JO.GetField("CPU_ABI") 'Deprecated since SDK21, although still available
        Return OO.Contains("64")
    End If
    Dim OO64() As String = JO.GetField("SUPPORTED_64_BIT_ABIS")
    Return (OO64<>Null And OO64.Length>0)  
End Sub
 
Upvote 0

aidymp

Well-Known Member
Licensed User
Longtime User
This should work
B4X:
Sub is64 As Boolean

    Dim JO As JavaObject
    JO.InitializeStatic("android.os.Build")
    Dim p As Phone
    If p.SdkVersion<21 Then
        Dim OO As String = JO.GetField("CPU_ABI") 'Deprecated since SDK21, although still available
        Return OO.Contains("64")
    End If
    Dim OO64() As String = JO.GetField("SUPPORTED_64_BIT_ABIS")
    Return (OO64<>Null And OO64.Length>0) 
End Sub

Thank you that works perfectly!
 
Upvote 0
Top