How do I know if an application process is 32-bit or 64-bit programmatically in Android lollipop?

As we all know, there is support for Android 5.0.64bit. I have a very simple question. Can we programmatically check in which mode any application is running, i.e. 32-bit or 64-bit? For example: I have a Facebook app running on my Nexus 9, so I can check my Android app usage if the Facebook app process is running in 32 bit mode or 64 bit mode?

Thanks in advance!

+3


source to share


3 answers


Try it System.getProperty("os.arch")

. I haven't tried this on 64-bit Android, but it should return something like "aarch64" in the case of a 64-bit device.



http://developer.android.com/reference/java/lang/System.html#getProperty(java.lang.String)

+4


source


On the Nexus 5x

String arch = System.getProperty("os.arch");

      

returns

armv8l

      

it is not aarch64

and my code broke. Nevertheless,

root@bullhead:/ # uname -m
aarch64

root@bullhead:/ # getprop ro.product.cpu.abilist
arm64-v8a,armeabi-v7a,armeabi

      

Wired. So I changed my code to

boolean is64 = (android.os.Build.VERSION.SDK_INT >= 21) && System.getProperty("ro.product.cpu.abilist").contains("64");

      



Updated 2016-02-11

In Samsung Samsung Galaxy S5 Neo, Android 5.1.1

String arch = System.getProperty("os.arch");

      

returns aarch64

, but it's not a 64-bit device !!!

ro.product.cpu.abilist

returns armeabi-v7a,armeabi

bool is64Bit =   System.getProperty("ro.product.cpu.abilist").contains("64");

      

Check

is the only way to check.

+4


source


What makes you think your device is not 64-bit? the specifications for the phone indicate that it uses the Exynos 7 Octa 7580 which is arm8 and 64-bit.

0


source







All Articles