zoukankan      html  css  js  c++  java
  • Android 获取手机内部信息,内核版本、基带版本、内部版本等

    TextView text = (TextView) findViewById(R.id.textView1);  
      
    String phoneInfo = "Product: " + android.os.Build.PRODUCT + "
    ";  
    phoneInfo += ", CPU_ABI: " + android.os.Build.CPU_ABI + "
    ";  
    phoneInfo += ", TAGS: " + android.os.Build.TAGS + "
    ";  
    phoneInfo += ", VERSION_CODES.BASE: "+ android.os.Build.VERSION_CODES.BASE + "
    ";  
    phoneInfo += ", MODEL: " + android.os.Build.MODEL + "
    ";  
    phoneInfo += ", SDK: " + android.os.Build.VERSION.SDK + "
    ";  
    phoneInfo += ", VERSION.RELEASE: " + android.os.Build.VERSION.RELEASE+ "
    ";  
    phoneInfo += ", DEVICE: " + android.os.Build.DEVICE + "
    ";  
    phoneInfo += ", DISPLAY: " + android.os.Build.DISPLAY + "
    ";  
    phoneInfo += ", BRAND: " + android.os.Build.BRAND + "
    ";  
    phoneInfo += ", BOARD: " + android.os.Build.BOARD + "
    ";  
    phoneInfo += ", FINGERPRINT: " + android.os.Build.FINGERPRINT + "
    ";  
    phoneInfo += ", ID: " + android.os.Build.ID + "
    ";  
    phoneInfo += ", MANUFACTURER: " + android.os.Build.MANUFACTURER + "
    ";  
    phoneInfo += ", USER: " + android.os.Build.USER + "
    ";  
    phoneInfo += ", BOOTLOADER: " + android.os.Build.BOOTLOADER + "
    ";  
    phoneInfo += ", HARDWARE: " + android.os.Build.HARDWARE + "
    ";  
    phoneInfo += ", INCREMENTAL: " + android.os.Build.VERSION.INCREMENTAL+ "
    ";  
    phoneInfo += ", CODENAME: " + android.os.Build.VERSION.CODENAME + "
    ";  
    phoneInfo += ", SDK: " + android.os.Build.VERSION.SDK_INT + "
    ";  
    text.setText(phoneInfo);   
      
      
     /** 
      * BASEBAND-VER 
      * 基带版本 
      * return String 
      */  
       
    public static String getBaseband_Ver(){  
    String Version = "";  
    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"});  
    // System.out.println(">>>>>>><<<<<<<" +(String)result);  
    Version = (String)result;  
    } catch (Exception e) {  
    }  
    return Version;  
    }  
      
    /** 
    * CORE-VER 
    * 内核版本 
    * return String 
    */  
      
    public static String getLinuxCore_Ver() {  
    Process process = null;  
    String kernelVersion = "";  
    try {  
    process = Runtime.getRuntime().exec("cat /proc/version");  
    } catch (IOException e) {  
    // TODO Auto-generated catch block  
    e.printStackTrace();  
    }  
      
      
    // get the output line  
    InputStream outs = process.getInputStream();  
    InputStreamReader isrout = new InputStreamReader(outs);  
    BufferedReader brout = new BufferedReader(isrout, 8 * 1024);  
      
      
    String result = "";  
    String line;  
    // get the whole standard output string  
    try {  
    while ((line = brout.readLine()) != null) {  
    result += line;  
    }  
    } catch (IOException e) {  
    // TODO Auto-generated catch block  
    e.printStackTrace();  
    }  
      
      
    try {  
    if (result != "") {  
    String Keyword = "version ";  
    int index = result.indexOf(Keyword);  
    line = result.substring(index + Keyword.length());  
    index = line.indexOf(" ");  
    kernelVersion = line.substring(0, index);  
    }  
    } catch (IndexOutOfBoundsException e) {  
    e.printStackTrace();  
    }  
    return kernelVersion;  
    }  
      
    /** 
    * INNER-VER 
    * 内部版本 
    * return String 
    */  
      
    public static String getInner_Ver(){  
    String ver = "" ;  
      
    if(android.os.Build.DISPLAY .contains(android.os.Build.VERSION.INCREMENTAL)){  
    ver = android.os.Build.DISPLAY;  
    }else{  
    ver = android.os.Build.VERSION.INCREMENTAL;  
    }  
    return ver;  
      
    }  
  • 相关阅读:
    C++出现 error: no match for 'operator==' (operand types are 'Person' and 'const Person')
    python三元运算符公式/出错怎么看
    我学函数遗漏的东西
    学习函数时一些没注意到的地方
    Python文件操作回顾
    我学习python没有记住的东西
    转载
    UE SC -kismetmathlibrary
    LineTrace跟Overlap开销
    UE4 插件无法读取常见错误
  • 原文地址:https://www.cnblogs.com/baiyi168/p/8489247.html
Copyright © 2011-2022 走看看