• android 获取SD卡相关信息


            Object localOb;
            String str1 = null;
    
            try {
                localOb = new FileReader("/sys/block/mmcblk0/device/type");
                localOb = new BufferedReader((Reader) localOb).readLine()
                        .toLowerCase().contentEquals("sd");
                if (localOb != null) {
                    str1 = "/sys/block/mmcblk0/device/";
                }
            } catch (Exception e1) {
                System.out.println(e1.getMessage());
            }
            try {
                localOb = new FileReader("/sys/block/mmcblk1/device/type");
                localOb = new BufferedReader((Reader) localOb).readLine()
                        .toLowerCase().contentEquals("sd");
                if (localOb != null) {
                    str1 = "/sys/block/mmcblk1/device/";
                }
            } catch (Exception e1) {
                System.out.println(e1.getMessage());
            }
            try {
    
                localOb = new FileReader("/sys/block/mmcblk2/device/type");
                localOb = new BufferedReader((Reader) localOb).readLine()
                        .toLowerCase().contentEquals("sd");
                if (localOb != null) {
                    str1 = "/sys/block/mmcblk2/device/";
                }
            } catch (Exception e1) {
                System.out.println(e1.getMessage());
            }
            localOb = "";
            try {
                localOb = new FileReader(str1 + "name"); // 厂商
                String sd_name = new BufferedReader((Reader) localOb).readLine();
                System.out.println("name: " + sd_name);
            } catch (Exception e1) {
                System.out.println(e1.getMessage());
            }
    
            try {
                localOb = new FileReader(str1 + "cid"); // SD Card ID
                String sd_cid = new BufferedReader((Reader) localOb).readLine();
                System.out.println("cid: " + sd_cid);
            } catch (Exception e1) {
                System.out.println(e1.getMessage());
            }
    
            try {
                localOb = new FileReader(str1 + "csd");
                String sd_csd = new BufferedReader((Reader) localOb).readLine();
                System.out.println("csd: " + sd_csd);
            } catch (Exception e1) {
                System.out.println(e1.getMessage());
            }
    
            try {
                localOb = new FileReader(str1 + "fwrev"); // 固件编号
                String sd_fwrev = new BufferedReader((Reader) localOb).readLine();
                System.out.println("fwrev: " + sd_fwrev);
            } catch (Exception e1) {
                System.out.println(e1.getMessage());
            }
    
            try {
                localOb = new FileReader(str1 + "hwrev"); // 硬件版本
                String sd_hwrev = new BufferedReader((Reader) localOb).readLine();
                System.out.println("hwrev: " + sd_hwrev);
            } catch (Exception e1) {
                System.out.println(e1.getMessage());
            }
    
            try {
                localOb = new FileReader(str1 + "manfid"); // manufacture 制造
                String sd_manfid = new BufferedReader((Reader) localOb).readLine();
                System.out.println("manfid: " + sd_manfid);
            } catch (Exception e1) {
                System.out.println(e1.getMessage());
            }
    
            try {
                localOb = new FileReader(str1 + "oemid"); // 原始设备制造商
                String sd_oemid = new BufferedReader((Reader) localOb).readLine();
                System.out.println("oemid: " + sd_oemid);
            } catch (Exception e1) {
                System.out.println(e1.getMessage());
            }
    
            try {
                localOb = new FileReader(str1 + "scr");
                String sd_scr = new BufferedReader((Reader) localOb).readLine();
                System.out.println("scr: " + sd_scr);
            } catch (Exception e1) {
                System.out.println(e1.getMessage());
            }
    
            try {
                localOb = new FileReader(str1 + "serial"); // 串号/序列号
                String sd_serial = new BufferedReader((Reader) localOb).readLine();
                System.out.println("serial: " + sd_serial);
            } catch (Exception e1) {
                System.out.println(e1.getMessage());
            }
    
            try {
                localOb = new FileReader(str1 + "date"); // 生产日期
                String sd_date = new BufferedReader((Reader) localOb).readLine();
                System.out.println("date: " + sd_date);
            } catch (Exception e1) {
                System.out.println(e1.getMessage());
            }
  • 相关阅读:
    .net 平台 统计图表展示控件fusioncharts
    sql 查分数段人数
    小程序开发之填坑之路
    提高网站性能
    javascript History对象详解
    vue的双向数据绑定
    静态文件对加快文件加载速度的影响
    JavaScript代码异常监控
    BEM命名规则
    浏览器缓存
  • 原文地址:https://www.cnblogs.com/profession/p/3663267.html
Copyright © 2020-2023  润新知