android 获取SD卡相关信息

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());
        }
android 获取SD卡相关信息

 

android 获取SD卡相关信息,布布扣,bubuko.com

android 获取SD卡相关信息

上一篇:iOS开发之Core Animation


下一篇:微信公众平台开发(28) 发送客服消息