android - How to read the SD Card ID number? -
How can I programmatically read the CID register of the SD card, which has a serial number and other information? Can I do this via Android Java or native code?
Thank you in advance, Eric
To get SID and CID here If the sample code is
then try {{file input = new file ("/ sys / class / mmc_host / mmc1") (Exceranlostorage available); String cid_directory = null; Int i = 0; File [] sid = input.listFiles (); (I = 0; i & lt; sid.length; i ++) {if (sid [i] .toString () includes ("mmc1:")) {cid_directory = sid [i] .toString (); String cid = (string) sid [i] .toString (). All sequence (cid_directory.length () - 4, cid_directory.length ()); Log D. (Tag, "MMC's SID =" + SID); break; }} BufferedReader CID = New BufferedReader (New FileReader (cid_directory + "/ cid")); String sd_cid = CID.readLine (); Log D. (Tag, "MMC's CID =" + sd_cid); } Hold (exception e) {log. ("CID_APP", "SD-card syed can not be read"); }} Else {Toast.makeText (this, "external storage is not available !!", Toast.LnnGHHRT). Show (); }
Comments
Post a Comment