Determine the mobile phone model and cpu Model

Source: Internet
Author: User

Determine the mobile phone model and cpu Model

Determine the mobile phone model:
private boolean isUnusualPhone(){try {Class
  cl = Class.forName("android.os.SystemProperties");Object invoker = cl.newInstance();Method m = cl.getMethod("get", new Class[] { String.class,String.class });Object result = m.invoke(invoker, new Object[] {"gsm.version.baseband", "no message" });return ((String) result).equals("I9250XXLJ1") || Build.MODEL.equals("MI 3");} catch (Exception e) {return true;}}


Determine the mobile phone cpu model:

// android 2.3 for arm v5 yanqingpublic boolean hasCompatibleCPU() {// If already checked return cached resultString CPU_ABI = android.os.Build.CPU_ABI;String CPU_ABI2 = "none";if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) { // CPU_ABI2// since// 2.2try {CPU_ABI2 = (String) android.os.Build.class.getDeclaredField("CPU_ABI2").get(null);} catch (Exception e) {return false;}}if (CPU_ABI.equals("armeabi-v7a") || CPU_ABI2.equals("armeabi-v7a")) {return true;}try {FileReader fileReader = new FileReader("/proc/cpuinfo");BufferedReader br = new BufferedReader(fileReader);String line;while ((line = br.readLine()) != null) {if (line.contains("ARMv7")) {return true;}}fileReader.close();} catch (IOException ex) {ex.printStackTrace();return false;}return false;}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.