Hi All,
I am able to insert the contacts into SIM card and delete from it. But it needs to be phone restart to update the changes.
The below is the code woks for delete the conatcs,
Uri simUri = Uri.parse("content://icc/adn");
Cursor cur = context.getContentResolver().query(simUri, null, null, null, null);
prn("Number of SIM Contacts are.."+cur.getCount());
int row =0;
while(cur.moveToNext()){
String name = cur.getString(cur.getColumnIndex("name"));
prn("Name..."+name);
String data = cur.getString(cur.getColumnIndex("number"));
if(!data.equals(""))
prn("Number.."+data);
String where = null;
if(!name.equals("") && !data.equals("")){
where = "tag =" + name + "AND" + "number =" +data;
}
else if(name.equals("") && !data.equals("")){
where = "number ="+data;
}
else {
where = "tag ="+name+ "AND" +"number="+null;
}
context.getContentResolver().delete(simUri, where, null);
row++;
}
prn(row+" are deleted");
cur.close();
cur = null;
Please look into this issue and give suggestions on this.
Thanks, Girish G M