Presence status on user contacts disappears after a short time

I made my own SyncAdatperto add the contacts of my application to the contacts on the phone. Now everything works (image, status, user actions, etc.), except for the presence state.

According to google:

Because presence status is inherently variable, the content provider may not store this field for long-term storage.

So, I do not know how to constantly keep a presence in contacts. Code to update presence inside cursor

ContentProviderOperation.Builder builder = ContentProviderOperation.newInsert(ContactsContract.StatusUpdates.CONTENT_URI);
builder.withValue(ContactsContract.StatusUpdates.DATA_ID, c.getLong(1));
builder.withValue(ContactsContract.StatusUpdates.STATUS, status);
builder.withValue(ContactsContract.StatusUpdates.STATUS_RES_PACKAGE, "ar.com.indiesoftware.ps3trophies");
builder.withValue(ContactsContract.StatusUpdates.STATUS_LABEL, R.string.app_name);
builder.withValue(ContactsContract.StatusUpdates.STATUS_ICON, R.drawable.alltrophies);

builder.withValue(ContactsContract.StatusUpdates.PROTOCOL, Im.PROTOCOL_CUSTOM);
builder.withValue(ContactsContract.StatusUpdates.CUSTOM_PROTOCOL, "PS3SyncAdapter");
builder.withValue(ContactsContract.StatusUpdates.IM_ACCOUNT, username);
builder.withValue(ContactsContract.StatusUpdates.IM_HANDLE, username);
builder.withValue(ContactsContract.StatusUpdates.PRESENCE, ContactsContract.StatusUpdates.AVAILABLE);

builder.withValue(ContactsContract.StatusUpdates.STATUS_TIMESTAMP, System.currentTimeMillis());
operationList.add(builder.build());

A green dot appears, but if I leave the contacts screen and return within a short period of time (in seconds), sometimes the green dot is no longer there.

Is there something I can do to solve this?

+3
1

, , .

0

All Articles