read / write from sim card for android -
i've been trying read/write sim card still there's no luck.
here's code far:
//read sim public string adding() { uri simuri = uri.parse("content://icc/adn/"); cursor cursorsim = this.getcontentresolver().query(simuri, null, null,null, null); string b = ""; while (cursorsim.movetonext()) { b+= (cursorsim.getstring(cursorsim.getcolumnindex("name"))); b += "\n" + (cursorsim.getstring(cursorsim.getcolumnindex("_id"))); b+= "\n" + (cursorsim.getstring(cursorsim.getcolumnindex("number"))); } return b; }
//to write sim
public void testing4() { contentvalues values = new contentvalues(); values.put( "tag", "test" ); values.put( "number", "1234" ); getcontentresolver().insert( uri.parse("content://icc/adn/"); , values ); }
please let me know if know this.
thanks
there misspelling in writing usim.
getcontentresolver().insert(uri.parse("content://icc/adn"), values);
also permission should added in androidmanifest.
(side question) in simsalabim's source code, don't know meaning of class variable "contact". can't find package can imported. in eclipse, there errors in "contact" lines.
the source code says file content://icc/adn
android version on 1.6, 1.5 content://sim/adn
.
(side result) found size of "number" field can on 64 characters. in read process, correct value can retrieved. real phone screen can't show full characters.
Comments
Post a Comment