Most visited

Recently visited

Added in API level 14

ContactsContract.DataUsageFeedback

public static final class ContactsContract.DataUsageFeedback
extends Object

java.lang.Object
   ↳ android.provider.ContactsContract.DataUsageFeedback


API allowing applications to send usage information for each ContactsContract.Contacts.Data row to the Contacts Provider. Applications can also clear all usage information.

With the feedback, Contacts Provider may return more contextually appropriate results for Data listing, typically supplied with CONTENT_FILTER_URI, CONTENT_FILTER_URI, CONTENT_FILTER_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 update(Uri, ContentValues, String, String[]) with a Uri constructed from FEEDBACK_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 query(Uri, String[], String, String[], String) toward CONTENT_URI.

update(Uri, ContentValues, String, String[]) returns a positive integer when successful, and returns 0 if no contact with that id was found.

Example:

 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;
 

Applications can also clear all usage information with:

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

Summary

Constants

String USAGE_TYPE

Name for query parameter specifying the type of data usage.

String USAGE_TYPE_CALL

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

String USAGE_TYPE_LONG_TEXT

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

String USAGE_TYPE_SHORT_TEXT

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

Fields

public static final Uri DELETE_USAGE_URI

The content:// style URI for deleting all usage information.

public static final Uri FEEDBACK_URI

The content:// style URI for sending usage feedback.

Public constructors

ContactsContract.DataUsageFeedback()

Inherited methods

From class java.lang.Object

Constants

USAGE_TYPE

Added in API level 14
String USAGE_TYPE

Name for query parameter specifying the type of data usage.

Constant Value: "type"

USAGE_TYPE_CALL

Added in API level 14
String USAGE_TYPE_CALL

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

Constant Value: "call"

USAGE_TYPE_LONG_TEXT

Added in API level 14
String USAGE_TYPE_LONG_TEXT

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

Constant Value: "long_text"

USAGE_TYPE_SHORT_TEXT

Added in API level 14
String USAGE_TYPE_SHORT_TEXT

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

Constant Value: "short_text"

Fields

DELETE_USAGE_URI

Added in API level 16
Uri DELETE_USAGE_URI

The content:// style URI for deleting all usage information. Must be used with delete(Uri, String, String[]). The where and selectionArgs parameters are ignored.

FEEDBACK_URI

Added in API level 14
Uri FEEDBACK_URI

The content:// style URI for sending usage feedback. Must be used with update(Uri, ContentValues, String, String[]).

Public constructors

ContactsContract.DataUsageFeedback

Added in API level 14
ContactsContract.DataUsageFeedback ()

Hooray!