Google Picker

Reference Guide

The following is a list of classes, methods, and enumerated types available in the Google Picker API. They all belong to the namespace google.picker.* There are two types of classes and enumerated types: those which are used to build and configure the Google Picker, and those which are returned by the Google Picker once the user has picked an item.

Configuration Classes and Types

The following classes and enumerated types are used to build and configure the Google Picker.

DocsUploadView

Use DocsUploadView to upload documents to Google Drive.

DocsUploadView()Constructor.
DocsUploadView.setIncludeFolders(boolean)Allows the user to select a folder in Google Drive to upload to.
DocsUploadView.setParent(string)Sets the upload destination to the specified folder. This overrides ".setIncludeFolders" to false.

DocsView

DocsView is a subclass of View that can be used for Google Drive views.

DocsView(ViewId | undefined)Constructor. The ViewId must be one of the Google Drive views. Default is ViewId.DOCS.
DocsView.setIncludeFolders(boolean)Show folders in the view items.
DocsView.setSelectFolderEnabled(boolean)Allows the user to select a folder in Google Drive.
DocsView.setMode(DocsViewMode)Selects which mode the view will use to display the documents.
DocsView.setOwnedByMe(boolean | undefined)Filters the documents based on whether they are owned by the user, or shared with the user.
DocsView.setParent(string)Sets the initial parent folder to display.
DocsView.setStarred(boolean)Filters the documents based on whether they are starred by the user.

DocsViewMode

DocsViewMode is an enumerated type for displaying data within a DocsView. Use these values in calls to DocsView.setMode.

DocsViewMode.GRIDDisplay documents in a thumbnail grid.
DocsViewMode.LISTDisplay documents in a detailed list.

Feature

Feature is an enumerated type, for turning on/off features for various views. Use these values in calls to PickerBuilder.enableFeature and PickerBuilder.disableFeature.

Feature.MINE_ONLYShow only documents owned by the user when showing items from Google Drive.
Feature.MULTISELECT_ENABLEDAllow user to choose more than one item.
Feature.NAV_HIDDENHide the navigation pane. If the navigation pane is hidden, users can only select from the first view chosen.
Feature.SIMPLE_UPLOAD_ENABLEDFor photo uploads, controls whether per-photo selection (as opposed to per-album) selection is enabled.

ImageSearchView

ImageSearchView is a subclass of View. Finer aspects of image searchs can be controlled using this class.

ImageSearchView()Constructor.
ImageSearchView.setLicense(ImageSearchView.License)Set the License filter for images. This allows clients to filter items returned based on Creative Commons attributes. For more details, read Usage Rights.
ImageSearchView.License.NONENo Creative Commons attributes required. All images.
ImageSearchView.License.COMMERCIAL_REUSEExcludes cc_noncommercial.
ImageSearchView.License.​COMMERCIAL_REUSE_WITH_MODIFICATIONExcludes cc_noncommercial and cc_nonderived. Default choice.
ImageSearchView.License.REUSENo exclusions for images with Creative Common attributes.
ImageSearchView.License.REUSE_WITH_MODIFICATIONExcludes cc_nonderived.
ImageSearchView.setSite(string)Add a site filter for image source. E.g. flickr.com. Only the last site set by setSite is honored (i.e. it is not cumulative.)
ImageSearchView.setSize(ImageSearchView.Size)Set the minimum size of image.
ImageSearchView.Size.SIZE_QSVGAImages at least 400x300 in either aspect ratio.
ImageSearchView.Size.SIZE_VGAImages at least 640x480.
ImageSearchView.Size.SIZE_SVGAImages at least 800x600.
ImageSearchView.Size.SIZE_XGAImages at least 1024x768.
ImageSearchView.Size.SIZE_WXGAImages at least 1280x800.
ImageSearchView.Size.SIZE_WXGA2Images at least 1440x900.
ImageSearchView.Size.SIZE_2MPImages at least 2 megapixels.
ImageSearchView.Size.SIZE_4MPImages at least 4 megapixels.
ImageSearchView.Size.SIZE_6MPImages at least 6 megapixels.
ImageSearchView.Size.SIZE_8MPImages at least 8 megapixels.
ImageSearchView.Size.SIZE_10MPImages at least 10 megapixels.
ImageSearchView.Size.SIZE_12MPImages at least 12 megapixels.
ImageSearchView.Size.SIZE_15MPImages at least 15 megapixels.
ImageSearchView.Size.SIZE_20MPImages at least 20 megapixels.
ImageSearchView.Size.SIZE_40MPImages at least 40 megapixels.
ImageSearchView.Size.SIZE_70MPImages at least 70 megapixels.
ImageSearchView.Size.SIZE_140MPImages at least 140 megapixels.

MapsView

MapsView is a subclass of View. Control the initial view for map selection using this class.

MapsView()Constructor.
MapsView.setCenter(number, number)Center the initial map view at a given coordinate. The arguments are latitude and longitude values, respectively.
MapsView.setZoom(number)Set the initial zoom level. Valid range is 0 to 21; a higher value indicates a greater zoom.

PhotoAlbumsView

PhotoAlbumsView is a subclass of View that can be used to select albums from Picasa Web Albums.

PhotoAlbumsView()Constructor.

PhotosView

PhotosView is a subclass of View. Finer aspects of photos selection can be controlled using this class.

PhotosView()Constructor.
PhotosView.setParent(string)Sets the initial parent album to display.
PhotosView.setType(PhotosView.Type)Filter photos shown in the view by PhotosView.Type.
PhotosView.Type.FEATUREDSelect photos from Picasa's "Featured Photos" gallery rather the the user's own photos.
PhotosView.Type.UPLOADEDSelect from the user's most recently uploaded Picasa photos, from any album, with the most recently uploaded photos shown first.

Picker

Picker is the top level object representing the UI action with the user. These objects are not created directly, but instead use the PickerBuilder object.

Picker.isVisible()Get a boolean indicating the current Picker visibility.
Picker.setCallback(function(object))Specify the callback method called whenever the user has picked an item (or canceled.)
Picker.setRelayUrl(string)Specify a relay URL to circumvent cross-domain issues.
Picker.setVisible(boolean)Control the visibility of the Picker object.

PickerBuilder

PickerBuilder is used to create Picker objects. Except where noted otherwise, the return type of methods below are of type PickerBuilder, allowing you to chain one call after another. See the Hello World example for typical use.

PickerBuilder()Constructor.
PickerBuilder.addView(View | ViewId)Add a View to the navigation pane.
PickerBuilder.addViewGroup(ViewGroup)Add a ViewGroup to the top-level navigation pane.
PickerBuilder.build()Construct the Picker object. The Picker object is returned.
PickerBuilder.disableFeature(Feature)Disable a picker feature.
PickerBuilder.enableFeature(Feature)Enable a picker feature.
PickerBuilder.getRelayUrl()Get the relay URL, used for gadgets.rpc.
PickerBuilder.getTitle()Get the dialog title.
PickerBuilder.hideTitleBar()Disable the title bar from being shown. To re-enable, call setTitle with a non-empty title or undefined.
PickerBuilder.isFeatureEnabled(Feature)Check if a picker Feature is enabled.
PickerBuilder.setAppId(string)Sets the Google Drive App ID needed to allow application to access the user's files via the Google Drive API.
PickerBuilder.setCallback(method)Set the callback method called when the user picks and item (or items), or cancels. The callback method receives a single callback object. The structure of the callback object is described in the JSON Guide.
PickerBuilder.setDeveloperKey(string)Sets the developer key obtained from Google Developers Console. See the Developer's Guide for details on how to obtain the developer key.
PickerBuilder.setDocument(document)Set the document.
PickerBuilder.setLocale(string)ISO 639 language code. If the language is not supported, en-US is used. This method provides an alternative to setting the locale at google.load() time. See the Developer's Guide for a list of supported locales.
PickerBuilder.setOAuthToken(string)Sets an OAuth token to use for authenticating the current user. Depending on the scope of the token, only certain views will display data. Valid scopes are Google Docs, Drive, Photos, YouTube.
PickerBuilder.setOrigin(string)Sets the origin of picker dialog. The origin should be set to the window.location.protocol + '//' + window.location.host of the top-most page, if your application is running in an iframe.
PickerBuilder.setRelayUrl(string)Set the relay URL, used for gadgets.rpc.
PickerBuilder.setSelectableMimeTypes(string)Set the list of MIME types which will be selectable. Use commas to separate MIME types if more than one is required.
PickerBuilder.setSize()Set the preferred dialog size. The dialog will be auto-centered. It has a minimum size of (566,350) and a maximum size of (1051,650).
PickerBuilder.setTitle(string)Set the dialog title.
PickerBuilder.setUploadToAlbumId(string)Specify an album ID for photo uploads. See Picasa Web Albums Data API documentation for more information about albums.
PickerBuilder.toUri()Returns the URI generated by this builder.

ResourceId

ResourceId is a static class used to generate resource IDs suitable for the Google Documents List API.

ResourceId.generate(Document)Map a document object to a resource ID.

VideoSearchView

VideoSearchView is a subclass of View. Use this class to select URLs of videos.

VideoSearchView()Constructor.
VideoSearchView.setSite(string)Constrain the video search results to a particular domain.
VideoSearchView.YOUTUBEA string constant suitable for the VideoSearchView.setSite() method.

View

View is the abstract base class for the various View classes, such as ImageSearchView.

View(ViewId)Constructor.
View.getId()Returns the ViewId for this view.
View.setMimeTypes(string)For views listing documents, set the MIME types which will be included in the view. Use commas to separate MIME types if more than one is required.
View.setQuery(string)For views involving searches, prepopulate the search query with these terms.

ViewGroup

ViewGroup is a visual grouping of views. The root item of the ViewGroup itself must be a View.

ViewGroup(View | ViewId)A ViewGroup is a visual grouping of Views in the navigation pane. The root item of the ViewGroup itself must be View.
ViewGroup.addLabel(string)Add a label to this ViewGroup.
ViewGroup.addView(ViewId | View)Add a view to the ViewGroup. The View can be represented by a View-derived object, or simply by ViewId.
ViewGroup.addViewGroup(ViewGroup)Nest a ViewGroup within the current ViewGroup.

ViewId

ViewId is an enumerated type, used for constructing View and ViewGroup objects.

ViewId.DOCSAll Google Drive document types.
ViewId.DOCS_IMAGESGoogle Drive photos.
ViewId.DOCS_IMAGES_AND_VIDEOSGoogle Drive photos and videos.
ViewId.DOCS_VIDEOSGoogle Drive videos.
ViewId.DOCUMENTSGoogle Drive Documents.
ViewId.DRAWINGSGoogle Drive Drawings.
ViewId.FOLDERSGoogle Drive Folders.
ViewId.FORMSGoogle Drive Forms.
ViewId.IMAGE_SEARCHGoogle Image Search.
ViewId.PDFSPDF files stored in Google Drive.
ViewId.PHOTO_ALBUMSPicasa Web Albums.
ViewId.PHOTO_UPLOADUpload to Picasa Web Albums.
ViewId.PHOTOSPicasa Web Album Photos.
ViewId.PRESENTATIONSGoogle Drive Presentations.
ViewId.RECENTLY_PICKEDA collection of most recently selected items.
ViewId.SPREADSHEETSGoogle Drive Spreadsheets.
ViewId.VIDEO_SEARCHGoogle Video Search.
ViewId.WEBCAMWebcam photos and videos.
ViewId.YOUTUBEYour YouTube videos.

WebCamView

WebCamView derives from View and is used to record videos or take photos using a web camera.

WebCamView(WebCamViewType | undefined)Constructor.

WebCamViewType

WebCamViewType is an enumerated type, used for constructing WebCamViews.

WebCamViewType.STANDARDTake a photo using a web camera.
WebCamViewType.VIDEOSRecord a video using a web camera (default).

Callback Types

The following enumerated types are found in callback data returned by the Google Picker API.

Action

Action is an enumerated type representing the action taken by the user to dismiss the dialog. This value will in the Response.ACTION field in the callback data.

Action.CANCELUser canceled the picker dialog.
Action.PICKEDUser has chosen at least one item.

Audience

Audience is an enumerated type representing the audience of a photo album. This value will be in the Document.AUDIENCE field of the Document object when a Picasa Web Album album is picked.

Audience.OWNER_ONLYContents are accessible only to the owner.
Audience.LIMITEDContents are accessible to users other than the owner.
Audience.ALL_PERSONAL_CIRCLESContents are accessible to those in the owner's circles.
Audience.EXTENDED_CIRCLESContents are accessible to those in the owner's extended circles.
Audience.DOMAIN_PUBLICContents are accessible to everyone within the user's Google Apps domain.
Audience.PUBLICContents are accessible to everyone.

Document

Document is an enumerated type used to convey information about a specific picked item. Only fields which are relevant to the selected item are returned. This value will be in the Response.DOCUMENTS field in the callback data.

Document.ADDRESS_LINESThe address of the picked location.
Document.AUDIENCEAn Audience type used to convey the audience of a Picasa Web Album.
Document.DESCRIPTIONA user-contributed description of the picked item.
Document.DURATIONThe duration of a picked video.
Document.EMBEDDABLE_URLA URL for this item suitable for embedding in a web page.
Document.ICON_URLA URL to an icon for this item.
Document.IDThe id for the picked item.
Document.IS_NEWReturns true if the picked item was just uploaded.
Document.LAST_EDITED_UTCThe timestamp describing when this item was last edited.
Document.LATITUDEThe latitude of the picked location.
Document.LONGITUDEThe longitude of the picked location.
Document.MIME_TYPEThe MIME type of this item.
Document.NAMEThe name of this item.
Document.NUM_CHILDRENThe number of children contained in this item. For example, the number of photos in a selected album.
Document.PARENT_IDThe parent id of this item. For example, the album which contains this photo.
Document.PHONE_NUMBERSThe phone number of the picked location.
Document.SERVICE_IDA ServiceId describing the service this item was picked from.
Document.THUMBNAILSAn array of Thumbnails which describe the attributes of a photo or video. Thumbnails will not be returned if the picked items belong to Google Drive.
Document.TYPEThe Type of the picked item.
Document.URLA URL to this item.

Response

Response is an enumerated type used to convey information about the user's picked items.

Response.ACTIONAn Action type representing the action taken by the user to dismiss the dialog.
Response.DOCUMENTSAn array of Documents picked by the user.
Response.PARENTSThe parent ids of the items that were picked. (For example, the album of a picked photo.)
Response.VIEWThe View the user selected these items from.

ServiceId

ServiceId is an enumerated type used to describe the service the item was picked from. This value will be in the Document.SERVICE_ID field of the picked Document.

ServiceId.DOCSGoogle Drive.
ServiceId.MAPSGoogle Maps.
ServiceId.PHOTOSPicasa Web Albums.
ServiceId.SEARCH_APIGoogle Web Search.
ServiceId.URLA user-supplied URL.
ServiceId.YOUTUBEYouTube.

Thumbnail

Thumbnail is an enumerated type used to convey information about a picker photo or video. This value can be found in the Document.THUMBNAILS field of a picked Document.

Thumbnail.HEIGHTThe height of the photo or video in pixels.
Thumbnail.WIDTHThe width of the photo or video in pixels.
Thumbnail.URLA URL to the selected photo or video.

Type

Type is an enumerated type used to catorgize the picked item. This value can be found in the Document.TYPE field of a picked Document.

Type.ALBUMThe item is a Picasa Web Albums photo album.
Type.DOCUMENTThe item is a document.
Type.LOCATIONThe item is a location.
Type.PHOTOThe item is a photo.
Type.URLThe item is a URL.
Type.VIDEOThe item is a video.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.