Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to fix disapearing of programmatically added SIM contacts after phone restart?
    primarykey
    data
    text
    <p>Using following code Contact gets added into SIM but on restart it disappears. One more observation is - Before restart if we edit this SIM contact(which is added programmatically) android's contact app crashes but Contact gets edited and on restart it remains its not disappearing. </p> <p>On devices other than Samsung its not at all showing contacts in android's default Contacts app. but I pulled the Contacts database and checked .. it contains contacts I have inserted programmatically. I checked this on LG Optimus.</p> <p>Can anyone help what all other columns I need to consider or any prob with existing columns. Thanks in advance.</p> <p>Checked this on Samsung Devices, Europa, S3.</p> <pre><code>private void addSIMContacts() { // TODO Auto-generated method stub ArrayList&lt;ContentProviderOperation&gt; ops = new ArrayList&lt;ContentProviderOperation&gt;(); int rawContactInsertIndex = ops.size(); ops.add(ContentProviderOperation .newInsert(RawContacts.CONTENT_URI) .withValue(RawContacts.ACCOUNT_TYPE, new String("vnd.sec.contact.sim")) .withValue(RawContacts.ACCOUNT_NAME, new String("vnd.sec.contact.sim")) .withValue(RawContacts.SOURCE_ID, new String("1")).build()); ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE) .withValue(Phone.NUMBER, "9X-XXXXXXXXX").build()); ops.add(ContentProviderOperation .newInsert(Data.CONTENT_URI) .withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex) .withValue(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE) .withValue(StructuredName.DISPLAY_NAME, "om").build()); try { ContentProviderResult[] res = getContentResolver().applyBatch( ContactsContract.AUTHORITY, ops); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (OperationApplicationException e) { // TODO Auto-generated catch block e.printStackTrace(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload