Compartilhar via


ContactsContract.StreamItemPhotos Class

Definition

Caution

This class is obsoleted in this android platform

Constants for the stream_item_photos table, which contains photos associated with social stream updates.

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

Remarks

Constants for the stream_item_photos table, which contains photos associated with social stream updates.

Access to social stream photos requires additional permissions beyond the read/write contact permissions required by the provider. Querying for social stream photos requires android.permission.READ_SOCIAL_STREAM permission, and inserting or updating social stream photos 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 photo entries are associated with a social stream item. Photos can be inserted into a social stream item in a couple of ways: <dl> <dt> Via the StreamItems.StreamItemPhotos#CONTENT_DIRECTORY sub-path of a stream item: </dt> <dd>

ContentValues values = new ContentValues();
            values.put(StreamItemPhotos.SORT_INDEX, 1);
            values.put(StreamItemPhotos.PHOTO, photoData);
            Uri.Builder builder = StreamItems.CONTENT_URI.buildUpon();
            ContentUris.appendId(builder, streamItemId);
            builder.appendEncodedPath(StreamItems.StreamItemPhotos.CONTENT_DIRECTORY);
            builder.appendQueryParameter(RawContacts.ACCOUNT_NAME, accountName);
            builder.appendQueryParameter(RawContacts.ACCOUNT_TYPE, accountType);
            Uri photoUri = getContentResolver().insert(builder.build(), values);
            long photoId = ContentUris.parseId(photoUri);

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

ContentValues values = new ContentValues();
            values.put(StreamItemPhotos.STREAM_ITEM_ID, streamItemId);
            values.put(StreamItemPhotos.SORT_INDEX, 1);
            values.put(StreamItemPhotos.PHOTO, photoData);
            Uri.Builder builder = StreamItems.CONTENT_PHOTO_URI.buildUpon();
            builder.appendQueryParameter(RawContacts.ACCOUNT_NAME, accountName);
            builder.appendQueryParameter(RawContacts.ACCOUNT_TYPE, accountType);
            Uri photoUri = getContentResolver().insert(builder.build(), values);
            long photoId = ContentUris.parseId(photoUri);

</dd> </dl> </p> </dd> <dt><b>Update</b></dt> <dd>

Updates can only be made against a specific StreamItemPhotos entry, identified by both the stream item ID it belongs to and the stream item photo ID. This can be specified in two ways. <dl> <dt>Via the StreamItems.StreamItemPhotos#CONTENT_DIRECTORY sub-path of a stream item: </dt> <dd>

ContentValues values = new ContentValues();
            values.put(StreamItemPhotos.PHOTO, newPhotoData);
            Uri.Builder builder = StreamItems.CONTENT_URI.buildUpon();
            ContentUris.appendId(builder, streamItemId);
            builder.appendEncodedPath(StreamItems.StreamItemPhotos.CONTENT_DIRECTORY);
            ContentUris.appendId(builder, streamItemPhotoId);
            builder.appendQueryParameter(RawContacts.ACCOUNT_NAME, accountName);
            builder.appendQueryParameter(RawContacts.ACCOUNT_TYPE, accountType);
            getContentResolver().update(builder.build(), values, null, null);

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

ContentValues values = new ContentValues();
            values.put(StreamItemPhotos.STREAM_ITEM_ID, streamItemId);
            values.put(StreamItemPhotos.PHOTO, newPhotoData);
            Uri.Builder builder = StreamItems.CONTENT_PHOTO_URI.buildUpon();
            builder.appendQueryParameter(RawContacts.ACCOUNT_NAME, accountName);
            builder.appendQueryParameter(RawContacts.ACCOUNT_TYPE, accountType);
            getContentResolver().update(builder.build(), values);

</dd> </dl> </p> </dd> <dt><b>Delete</b></dt> <dd>Deletes can be made against either a specific photo item in a stream item, or against all or a selected subset of photo items under a stream item. For example: <dl> <dt>Deleting a single photo via the StreamItems.StreamItemPhotos#CONTENT_DIRECTORY sub-path of a stream item: </dt> <dd>

Uri.Builder builder = StreamItems.CONTENT_URI.buildUpon();
            ContentUris.appendId(builder, streamItemId);
            builder.appendEncodedPath(StreamItems.StreamItemPhotos.CONTENT_DIRECTORY);
            ContentUris.appendId(builder, streamItemPhotoId);
            builder.appendQueryParameter(RawContacts.ACCOUNT_NAME, accountName);
            builder.appendQueryParameter(RawContacts.ACCOUNT_TYPE, accountType);
            getContentResolver().delete(builder.build(), null, null);

</dd> <dt>Deleting all photos under a stream item</dt> <dd>

Uri.Builder builder = StreamItems.CONTENT_URI.buildUpon();
            ContentUris.appendId(builder, streamItemId);
            builder.appendEncodedPath(StreamItems.StreamItemPhotos.CONTENT_DIRECTORY);
            builder.appendQueryParameter(RawContacts.ACCOUNT_NAME, accountName);
            builder.appendQueryParameter(RawContacts.ACCOUNT_TYPE, accountType);
            getContentResolver().delete(builder.build(), null, null);

</dd> </dl> </dd> <dt><b>Query</b></dt> <dl> <dt>Querying for a specific photo in a stream item</dt> <dd>

Cursor c = getContentResolver().query(
                ContentUris.withAppendedId(
                    Uri.withAppendedPath(
                        ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId)
                        StreamItems.StreamItemPhotos#CONTENT_DIRECTORY),
                    streamItemPhotoId), null, null, null, null);

</dd> <dt>Querying for all photos in a stream item</dt> <dd>

Cursor c = getContentResolver().query(
                Uri.withAppendedPath(
                    ContentUris.withAppendedId(StreamItems.CONTENT_URI, streamItemId)
                    StreamItems.StreamItemPhotos#CONTENT_DIRECTORY),
                null, null, null, StreamItemPhotos.SORT_INDEX);

</dl> The record will contain both a StreamItemPhotos#PHOTO_FILE_ID and a StreamItemPhotos#PHOTO_URI. The StreamItemPhotos#PHOTO_FILE_ID can be used in conjunction with the ContactsContract.DisplayPhoto API to retrieve photo content, or you can open the StreamItemPhotos#PHOTO_URI as an asset file, as follows:

public InputStream openDisplayPhoto(String photoUri) {
                try {
                    AssetFileDescriptor fd = getContentResolver().openAssetFileDescriptor(photoUri, "r");
                    return fd.createInputStream();
                } catch (IOException e) {
                    return null;
                }
            }
<pre>
</dd>
</dl>

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

Java documentation for android.provider.ContactsContract.StreamItemPhotos.

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

Photo
Obsolete.

The binary representation of the photo.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
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