Language

ContactsContract.Settings.SetAccountAttributes Method

Definition

Sets the attributes for a given account with a new set of flags.

[Android.Runtime.Register("setAccountAttributes", "(Landroid/content/ContentResolver;Landroid/accounts/Account;Ljava/lang/String;J)V", "", ApiSince=37)]
public static void SetAccountAttributes(Android.Content.ContentResolver resolver, Android.Accounts.Account? account, string? dataSet, long newAttributes);
[<Android.Runtime.Register("setAccountAttributes", "(Landroid/content/ContentResolver;Landroid/accounts/Account;Ljava/lang/String;J)V", "", ApiSince=37)>]
static member SetAccountAttributes : Android.Content.ContentResolver * Android.Accounts.Account * string * int64 -> unit

Parameters

resolver
ContentResolver

The ContentResolver to use for the update. This value cannot be null.

account
Account

The target account whose name and type are included in the request; null omits those account fields.

dataSet
String

The data set within the account, which may be null.

newAttributes
Int64

The complete new bitmask of attributes to apply. It can contain AttributeDataOriginLocal, AttributeDataOriginSim, AttributeDataOriginCloud, AttributeSyncModeUpSync, AttributeSyncModeDownSync, and AttributeDataTypeCustomDeclared. The provider can reject a bitmask with no data-origin flag or more than one data-origin flag.

Attributes

Exceptions

The provider rejects the account as invalid or the bitmask contains undefined bits.

The provider rejects the bitmask because it has no data-origin flag or has more than one.

The caller does not have permission to write contacts, the calling package is not the authenticator for the account type, or the provider rejects a null account.

The provider does not support setting account attributes.

Remarks

Sets the attributes for a given account with a new set of flags.

Warning: This is a destructive operation. Any attributes previously set on the account will be cleared and replaced by the provided newAttributes.

The provided bitmask must be valid and free of semantic conflicts (e.g., containing more than one DATA_ORIGIN type).

This method requires that the calling application be the authenticator for the account's type. Requires the WriteContacts permission.

Android reference for android.provider.ContactsContract.Settings.setAccountAttributes.

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.

Applies to