Share via


ContactsContract.StreamItems Class

Definition

Caution

This class is obsoleted in this android platform

Constants for the stream_items table, which contains social stream updates from the user's contact list.

[Android.Runtime.Register("android/provider/ContactsContract$StreamItems", DoNotGenerateAcw=true)]
[System.Obsolete("This class is obsoleted in this android platform")]
public sealed class ContactsContract.StreamItems : Java.Lang.Object
[<Android.Runtime.Register("android/provider/ContactsContract$StreamItems", DoNotGenerateAcw=true)>]
[<System.Obsolete("This class is obsoleted in this android platform")>]
type ContactsContract.StreamItems = class
    inherit Object
Inheritance
ContactsContract.StreamItems
Attributes

Remarks

Constants for the stream_items table, which contains social stream updates from the user's contact list.

Only a certain number of stream items will ever be stored under a given raw contact. Users of this API can query ContactsContract.StreamItems#CONTENT_LIMIT_URI to determine this limit, and should restrict the number of items inserted in any given transaction correspondingly. Insertion of more items beyond the limit will automatically lead to deletion of the oldest items, by StreamItems#TIMESTAMP.

Access to the social stream through these URIs requires additional permissions beyond the read/write contact permissions required by the provider. Querying for social stream data requires android.permission.READ_SOCIAL_STREAM permission, and inserting or updating social stream items requires android.permission.WRITE_SOCIAL_STREAM permission.

<h3>Account check</h3>

The content URIs to the insert, update and delete operations are required to have the account information matching that of the owning raw contact as query parameters, namely RawContacts#ACCOUNT_TYPE and RawContacts#ACCOUNT_NAME. RawContacts#DATA_SET isn't required.

<h3>Operations</h3> <dl> <dt><b>Insert</b></dt> <dd>

Social stream updates are always associated with a raw contact. There are a couple of ways to insert these entries. <dl> <dt>Via the RawContacts.StreamItems#CONTENT_DIRECTORY sub-path of a raw contact:</dt> <dd>

ContentValues values = new ContentValues();
            values.put(StreamItems.TEXT, "Breakfasted at Tiffanys");
            values.put(StreamItems.TIMESTAMP, timestamp);
            values.put(StreamItems.COMMENTS, "3 people reshared this");
            Uri.Builder builder = RawContacts.CONTENT_URI.buildUpon();
            ContentUris.appendId(builder, rawContactId);
            builder.appendEncodedPath(RawContacts.StreamItems.CONTENT_DIRECTORY);
            builder.appendQueryParameter(RawContacts.ACCOUNT_NAME, accountName);
            builder.appendQueryParameter(RawContacts.ACCOUNT_TYPE, accountType);
            Uri streamItemUri = getContentResolver().insert(builder.build(), values);
            long streamItemId = ContentUris.parseId(streamItemUri);

</dd> <dt>Via StreamItems#CONTENT_URI:</dt> <dd>

ContentValues values = new ContentValues();
            values.put(StreamItems.RAW_CONTACT_ID, rawContactId);
            values.put(StreamItems.TEXT, "Breakfasted at Tiffanys");
            values.put(StreamItems.TIMESTAMP, timestamp);
            values.put(StreamItems.COMMENTS, "3 people reshared this");
            Uri.Builder builder = StreamItems.CONTENT_URI.buildUpon();
            builder.appendQueryParameter(RawContacts.ACCOUNT_NAME, accountName);
            builder.appendQueryParameter(RawContacts.ACCOUNT_TYPE, accountType);
            Uri streamItemUri = getContentResolver().insert(builder.build(), values);
            long streamItemId = ContentUris.parseId(streamItemUri);

</dd> </dl> </dd> </p>

Once a StreamItems entry has been inserted, photos associated with that social update can be inserted. For example, after one of the insertions above, photos could be added to the stream item in one of the following ways: <dl> <dt>Via a URI including the stream item ID:</dt> <dd>

values.clear();
            values.put(StreamItemPhotos.SORT_INDEX, 1);
            values.put(StreamItemPhotos.PHOTO, photoData);
            getContentResolver().insert(Uri.withAppendedPath(
                ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId),
                StreamItems.StreamItemPhotos.CONTENT_DIRECTORY), values);

</dd> <dt>Via ContactsContract.StreamItems#CONTENT_PHOTO_URI:</dt> <dd>

values.clear();
            values.put(StreamItemPhotos.STREAM_ITEM_ID, streamItemId);
            values.put(StreamItemPhotos.SORT_INDEX, 1);
            values.put(StreamItemPhotos.PHOTO, photoData);
            getContentResolver().insert(StreamItems.CONTENT_PHOTO_URI, values);

Note that this latter form allows the insertion of a stream item and its photos in a single transaction, by using ContentProviderOperation with back references to populate the stream item ID in the ContentValues. </dd> </dl>

</dd> <dt><b>Update</b></dt> <dd>Updates can be performed by appending the stream item ID to the StreamItems#CONTENT_URI URI. Only social stream entries that were created by the calling package can be updated.</dd> <dt><b>Delete</b></dt> <dd>Deletes can be performed by appending the stream item ID to the StreamItems#CONTENT_URI URI. Only social stream entries that were created by the calling package can be deleted.</dd> <dt><b>Query</b></dt> <dl> <dt>Finding all social stream updates for a given contact</dt> <dd>By Contact ID:

Cursor c = getContentResolver().query(Uri.withAppendedPath(
                     ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId),
                     Contacts.StreamItems.CONTENT_DIRECTORY),
                     null, null, null, null);

</dd> <dd>By lookup key:

Cursor c = getContentResolver().query(Contacts.CONTENT_URI.buildUpon()
                     .appendPath(lookupKey)
                     .appendPath(Contacts.StreamItems.CONTENT_DIRECTORY).build(),
                     null, null, null, null);

</dd> <dt>Finding all social stream updates for a given raw contact</dt> <dd>

Cursor c = getContentResolver().query(Uri.withAppendedPath(
                     ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId),
                     RawContacts.StreamItems.CONTENT_DIRECTORY)),
                     null, null, null, null);

</dd> <dt>Querying for a specific stream item by ID</dt> <dd>

Cursor c = getContentResolver().query(ContentUris.withAppendedId(
                     StreamItems.CONTENT_URI, streamItemId),
                     null, null, null, null);

</dd> </dl>

This member is deprecated. - Do not use. This will not be supported in the future. In the future, cursors returned from related queries will be empty.

Java documentation for android.provider.ContactsContract.StreamItems.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Fields

ContentItemType
Obsolete.

The MIME type of a single stream item.

ContentType
Obsolete.

The MIME type of a directory of stream items.

MaxItems
Obsolete.

Queries to ContactsContract.StreamItems#CONTENT_LIMIT_URI will contain this column, with the value indicating the maximum number of stream items that will be stored under any single raw contact.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
ContentLimitUri
Obsolete.

This URI allows the caller to query for the maximum number of stream items that will be stored under any single raw contact.

ContentPhotoUri
Obsolete.

A content:// style URI for the photos stored in a sub-table underneath stream items.

ContentUri
Obsolete.

The content:// style URI for this table, which handles social network stream updates for the user's contacts.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to