GmailContract

public final class GmailContract

Contract for use with the Gmail content provider.

Developers can use this content provider to display label information to the user.
The label information includes:

  • Label name
  • Total number of conversations
  • Number of unread conversations
  • Label text color
  • Label background color

This content provider is available in Gmail version 2.3.6 or newer for Froyo/Gingerbread and version 4.0.5 and newer for Honeycomb and Ice Cream Sandwich

An application can query the Content Resolver directly (or use a Loader) to obtain a Cursor with information for all labels on an account

Cursor labelsCursor = getContentResolver().query(GmailContract.Labels.getLabelsUri( selectedAccount), null, null, null, null);

Nested Classes
GmailContract.Labels
Constants
AUTHORITY
PERMISSION
Public Methods
canReadLabels(Context c)

Constants

public static final String AUTHORITY

Authority for the Gmail content provider.

Constant Value: "com.google.android.gm"

public static final String PERMISSION

Permission required to access this android.content.ContentProvider

Constant Value: "com.google.android.gm.permission.READ_CONTENT_PROVIDER"

Public Methods

public static boolean canReadLabels (Context c)

Check if the installed Gmail app supports querying for label information.

Parameters
c an application Context
Returns
  • true if it's safe to make label API queries