# ContactsContract.DataUsageFeedback

Added in[API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# DataUsageFeedback

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/provider/ContactsContract.DataUsageFeedback "View this page in Java")  

```
class DataUsageFeedback
```

|---|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                             ||
| ↳ | [android.provider.ContactsContract.DataUsageFeedback](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.DataUsageFeedback#) |

*** ** * ** ***

| **This class was deprecated in API level 29.**
|
| Contacts affinity information is no longer supported as of Android version[android.os.Build.VERSION_CODES#Q](https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int). Both update and delete calls are always ignored.

API allowing applications to send usage information for each[Data](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Data)row to the Contacts Provider. Applications can also clear all usage information.

**Caution:** If you publish your app to the Google Play Store, this field is obsolete, regardless of Android version. For more information, see the[Contacts Provider](https://developer.android.com/reference/kotlin/guide/topics/providers/contacts-provider#ObsoleteData)page.

With the feedback, Contacts Provider may return more contextually appropriate results for Data listing, typically supplied with[ContactsContract.Contacts.CONTENT_FILTER_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_FILTER_URI:android.net.Uri),[ContactsContract.CommonDataKinds.Email.CONTENT_FILTER_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.CommonDataKinds.Email#CONTENT_FILTER_URI:android.net.Uri),[ContactsContract.CommonDataKinds.Phone.CONTENT_FILTER_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.CommonDataKinds.Phone#CONTENT_FILTER_URI:android.net.Uri), and users can benefit from better ranked (sorted) lists in applications that show auto-complete list.

There is no guarantee for how this feedback is used, or even whether it is used at all. The ranking algorithm will make best efforts to use the feedback data, but the exact implementation, the storage data structures as well as the resulting sort order is device and version specific and can change over time.

When updating usage information, users of this API need to use[ContentResolver.update(Uri, ContentValues, String, String[])](https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#update(android.net.Uri,%20android.content.ContentValues,%20kotlin.String,%20kotlin.Array))with a Uri constructed from[DataUsageFeedback.FEEDBACK_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.DataUsageFeedback#FEEDBACK_URI:android.net.Uri). The Uri must contain one or more data id(s) as its last path. They also need to append a query parameter to the Uri, to specify the type of the communication, which enables the Contacts Provider to differentiate between kinds of interactions using the same contact data field (for example a phone number can be used to make phone calls or send SMS).

Selection and selectionArgs are ignored and must be set to null. To get data ids, you may need to call[ContentResolver.query(Uri, String[], String, String[], String)](https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#query(android.net.Uri,%20kotlin.Array,%20kotlin.String,%20kotlin.Array,%20kotlin.String))toward[Data.CONTENT_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Data#CONTENT_URI:android.net.Uri).

[ContentResolver.update(Uri, ContentValues, String, String[])](https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#update(android.net.Uri,%20android.content.ContentValues,%20kotlin.String,%20kotlin.Array))returns a positive integer when successful, and returns 0 if no contact with that id was found.

Example:  

```kotlin
Uri uri = DataUsageFeedback.FEEDBACK_URI.buildUpon()
          .appendPath(TextUtils.join(",", dataIds))
          .appendQueryParameter(DataUsageFeedback.USAGE_TYPE,
                  DataUsageFeedback.USAGE_TYPE_CALL)
          .build();
  boolean successful = resolver.update(uri, new ContentValues(), null, null) > 0;
  
```

<br />

Applications can also clear all usage information with:  

```kotlin
boolean successful = resolver.delete(DataUsageFeedback.DELETE_USAGE_URI, null, null) > 0;
  
```

<br />

## Summary

|                                                                                                                                                                                 Constants                                                                                                                                                                                  ||
|----------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [USAGE_TYPE](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.DataUsageFeedback#USAGE_TYPE:kotlin.String) Name for query parameter specifying the type of data usage.                                                                              |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [USAGE_TYPE_CALL](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.DataUsageFeedback#USAGE_TYPE_CALL:kotlin.String) Type of usage for voice interaction, which includes phone call, voice chat, and video chat.                                    |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [USAGE_TYPE_LONG_TEXT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.DataUsageFeedback#USAGE_TYPE_LONG_TEXT:kotlin.String) Type of usage for text interaction involving longer messages, which includes email.                                  |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [USAGE_TYPE_SHORT_TEXT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.DataUsageFeedback#USAGE_TYPE_SHORT_TEXT:kotlin.String) Type of usage for text interaction involving shorter messages, which includes SMS, text chat with email addresses. |

|                                                                    Public constructors                                                                    ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [DataUsageFeedback](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.DataUsageFeedback#DataUsageFeedback())`()` <br /> |

|                                                                                                                                                Properties                                                                                                                                                ||
|------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)! | [DELETE_USAGE_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.DataUsageFeedback#DELETE_USAGE_URI:android.net.Uri) The content:// style URI for deleting all usage information. |
| static[Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)! | [FEEDBACK_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.DataUsageFeedback#FEEDBACK_URI:android.net.Uri) The content:// style URI for sending usage feedback.                 |

## Constants

### USAGE_TYPE

Added in[API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val USAGE_TYPE: String
```

**Deprecated:** *Deprecated in Java.*

Name for query parameter specifying the type of data usage.  

    Value: "type"

### USAGE_TYPE_CALL

Added in[API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val USAGE_TYPE_CALL: String
```

**Deprecated:** *Deprecated in Java.*

Type of usage for voice interaction, which includes phone call, voice chat, and video chat.  

    Value: "call"

### USAGE_TYPE_LONG_TEXT

Added in[API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val USAGE_TYPE_LONG_TEXT: String
```

**Deprecated:** *Deprecated in Java.*

Type of usage for text interaction involving longer messages, which includes email.  

    Value: "long_text"

### USAGE_TYPE_SHORT_TEXT

Added in[API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val USAGE_TYPE_SHORT_TEXT: String
```

**Deprecated:** *Deprecated in Java.*

Type of usage for text interaction involving shorter messages, which includes SMS, text chat with email addresses.  

    Value: "short_text"

## Public constructors

### DataUsageFeedback

```
DataUsageFeedback()
```

## Properties

### DELETE_USAGE_URI

Added in[API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val DELETE_USAGE_URI: Uri!
```

**Deprecated:** *Deprecated in Java.*

The content:// style URI for deleting all usage information. Must be used with[ContentResolver.delete(Uri, String, String[])](https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#delete(android.net.Uri,%20kotlin.String,%20kotlin.Array)). The`where`and`selectionArgs`parameters are ignored.  

### FEEDBACK_URI

Added in[API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val FEEDBACK_URI: Uri!
```

**Deprecated:** *Deprecated in Java.*

The content:// style URI for sending usage feedback. Must be used with[ContentResolver.update(Uri, ContentValues, String, String[])](https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#update(android.net.Uri,%20android.content.ContentValues,%20kotlin.String,%20kotlin.Array)).