Unable to delete contacts from SIM card.

I have a problem deleting the contacts that I previously created on the SIM card.

First of all, I check what values ​​are stored in the database as follows:

private static final Uri URI_ICC_ADN = Uri.parse("content://icc/adn/");
private ContentResolver mContentResolver = this.getContentResolver();

Cursor c = mContentResolver.query(URI_ICC_ADN, null, null, null, null);
c.moveToFirst();
while(c.moveToNext()) {
     Log.i(LOG_TAG, "name = " + c.getString(c.getColumnIndex("name")));
}

And that gives me those logs:

name = 1
name = 2
name = 3
name = 1
name = 2
name = 5
// etc

This means that records with name = 1exist in the database. Now I am trying to delete these entries using this code:

int rowsDeleted = mContentResolver.delete(URI_ICC_ADN, "name=?", new String[] { "1" });

But, unfortunately, these lines are not deleted - rowsDeletedequally 0. I also tried this:

int rowsDeleted = mContentResolver.delete(URI_ICC_ADN, "name=1", null);

But the result is the same. What am I doing wrong?

+4
source share
1 answer

"name" - . "" . IccProvider

+1

Source: https://habr.com/ru/post/1527451/


All Articles