Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

API call to get processor architecture

As part of my app I'm using the NDK and was wondering if it's worth bundling x86 and mips binaries alongside the standard ARM binaries.

I figured the best way would be to track what my users actually have, is there an API call to grab the processor architecture so I can pass this back to my Google analytics instance?

Thanks

like image 715
Ljdawson Avatar asked Aug 16 '12 14:08

Ljdawson


People also ask

How do I get Android architecture?

For the Android version, look at the OS version under the Device section. This explicitly displays the version number. For architecture info, slide over to the System tab and check out the CPU Architecture and Instruction Sets entries under the Processor tab.

What is Android abi?

Different Android devices use different CPUs, which in turn support different instruction sets. Each combination of CPU and instruction set has its own Application Binary Interface (ABI). An ABI includes the following information: The CPU instruction set (and extensions) that can be used.


1 Answers

Actually, you can get the architecture without the need for reflexion at all:

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

From my tests it returned armv71 and i686.

EDIT:

On MIPS architecture, it either returns 'mips' or 'mips64'

On 64 bit ARM/Intel, it returns 'aarch64' or 'x86_64' respectively.

like image 161
3c71 Avatar answered Sep 30 '22 16:09

3c71