Card
The Card object contains methods that invoke cards.
Learning Resources:
| Sample - Invoking cards Sample that demonstrates how to use the BlackBerry Invoke Cards API [BlackBerry on GitHub]. |
| Sample - Invoking cards as Share Targets Sample that demonstrates how to use the BlackBerry Invoke Cards API [BlackBerry on GitHub]. |
Supported Platform(s)
| - BlackBerry 10 |
Configuration Document Settings
|
To use all of the API described for this object, you must ensure the following settings are in your configuration document: |
|
You must declare the feature element(s) below in your configuration document: |
| Feature ID | BB5.0 | BB6.0 | BB7.0 | PB1.0 | PB2.0 | BB10 | Ripple |
|---|---|---|---|---|---|---|---|
| <feature id="blackberry.invoke.card" /> | Y |
| Permission Elements (PlayBook and BlackBerry 10+) |
|---|
| This API does not require a <permission> element to be declared in the configuration document of your BlackBerry WebWorks Application. |
Functions
Constants
| String | CAMERA_MODE_PHOTO |
| String | CAMERA_MODE_VIDEO |
| String | CAMERA_MODE_FULL |
| String | FILEPICKER_MODE_PICKER |
| String | FILEPICKER_MODE_SAVER |
| String | FILEPICKER_MODE_PICKER_MULTIPLE |
| String | FILEPICKER_MODE_SAVER_MULTIPLE |
| String | FILEPICKER_VIEWER_MODE_LIST |
| String | FILEPICKER_VIEWER_MODE_GRID |
| String | FILEPICKER_VIEWER_MODE_DEFAULT |
| String | FILEPICKER_SORT_BY_NAME |
| String | FILEPICKER_SORT_BY_DATE |
| String | FILEPICKER_SORT_BY_SUFFIX |
| String | FILEPICKER_SORT_BY_SIZE |
| String | FILEPICKER_SORT_ORDER_ASCENDING |
| String | FILEPICKER_SORT_ORDER_DESCENDING |
| String | FILEPICKER_TYPE_PICTURE |
| String | FILEPICKER_TYPE_DOCUMENT |
| String | FILEPICKER_TYPE_MUSIC |
| String | FILEPICKER_TYPE_VIDEO |
| String | FILEPICKER_TYPE_OTHER |
Functions
static
void
blackberry.invoke.card.invokeCalendarComposer
(options : blackberry.invoke.card.CalendarComposerOptions, onDone: function([data: String]), onCancel: function([reason: String]), onInvoke: function([error: String]))
Invokes calendar event composer card
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
| Parameters | |
|---|---|
| options | An object of type blackberry.invoke.card.CalendarComposerOptions which describes all options available to the event composer. |
| onDone |
The callback function that will be triggered when the user finished with the event composer.
data: The data string back from the event composer. |
| onCancel |
The callback function that will be triggered if the user cancel the event composer.
reason: A String that describes the reason the event composer was cancelled. |
| onInvoke |
The callback function that will be triggered when the event composer is invoked.
error: A String that describes if there was an error. No error will be returned on success. |
Code Example:
|
static
void
blackberry.invoke.card.invokeCalendarPicker
(options : blackberry.invoke.card.CalendarPickerOptions, onDone: function([data: String]), onCancel: function([reason: String]), onInvoke: function([error: String]))
Filepaths using the local:/// protocol are not supported for this card.
Invokes calendar event picker card.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
| Parameters | |
|---|---|
| options | An object of type blackberry.invoke.card.CalendarPickerOptions which describes all options available to the event picker. |
| onDone |
The callback function that will be triggered when the user finished with the event picker.
data: The data string back from the event picker. |
| onCancel |
The callback function that will be triggered if the user cancel the event picker.
reason: A String that describes the reason the event picker was cancelled. |
| onInvoke |
The callback function that will be triggered when the event picker is invoked.
error: A String that describes if there was an error. No error will be returned on success. |
Code Example:
|
static
void
blackberry.invoke.card.invokeCamera
(mode : String, onSave: function([path: String]), onCancel: function([reason: String]), onInvoke: function([error: String]))
Invokes the Camera Card.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
| Parameters | |
|---|---|
| mode | A string to specify the photo video or full mode. |
| onSave |
The callback function that will be triggered if the user saves a picture or video.
path: A String that describes the path of the file saved. |
| onCancel |
The callback function that will be triggered if the user does not save and simply quits the camera.
reason: A String that describes the reason the camera was cancelled. |
| onInvoke |
The callback function that will be triggered when the camera is invoked.
error: A String that describes if there was an error. No error will be returned on success. |
Code Example:
|
static
void
blackberry.invoke.card.invokeEmailComposer
(options : blackberry.invoke.card.EmailComposerOptions, onDone: function([data: String]), onCancel: function([reason: String]), onInvoke: function([error: String]))
Filepaths using the local:/// prototcol are supported for this card.
Invokes email composer card.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
| Parameters | |
|---|---|
| options | An object of type blackberry.invoke.card.EmailComposerOptions which describes all options available to the email composer. |
| onDone |
The callback function that will be triggered when the user finished with the email composer.
data: The data string back from the email composer. |
| onCancel |
The callback function that will be triggered if the user cancel the email composer.
reason: A String that describes the reason the email composer was cancelled. |
| onInvoke |
The callback function that will be triggered when the email composer is invoked.
error: A String that describes if there was an error. No error will be returned on success. |
Code Example:
|
static
void
blackberry.invoke.card.invokeFilePicker
(options : blackberry.invoke.card.FilePickerOptions, onDone: function([pathArray: String]), onCancel: function([reason: String]), onInvoke: function([error: String]))
Invokes the FilePicker Card.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
| Parameters | |
|---|---|
| options | An object to type blackberry.invoke.card.FilePickerOptions describe all the options available for FilePicker. |
| onDone |
The callback function that will be triggered if the user selects file(s) or folder(s).
pathArray: An Array that describes the path of each of the files saved. |
| onCancel |
The callback function that will be triggered if the user does not select file(s) or folder(s) and simply cancels.
reason: A String that describes the reason the FilePicker was cancelled. |
| onInvoke |
The callback function that will be triggered when the camera is invoked.
error: A String that describes if there was an error. No error will be returned on success. |
Code Example:
|
static
void
blackberry.invoke.card.invokeIcsViewer
(options : blackberry.invoke.card.IcsViewerOptions, onDone: function([data: String]), onCancel: function([reason: String]), onInvoke: function([error: String]))
Invokes the IcsViewer Card to display an iCalendar (.ics) event.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
| Parameters | |
|---|---|
| options | An object to type blackberry.invoke.card.IcsViewerOptions describes all the options available for IcsViewer. |
| onDone |
The callback function that will be triggered when the event is added to a calendar.
data: A data string might be an empty or to contain some information. |
| onCancel |
The callback function that will be triggered when the card invocation has been cancelled.
reason: A string that describes the reason the IcsViewer was cancelled. |
| onInvoke |
The callback function that will be triggered when the IcsViewer card is invoked.
error: A String that describes if there was an error. No error will be returned on success. |
Code Example:
|
static
void
blackberry.invoke.card.invokeMediaPlayer
(options : blackberry.invoke.card.MediaPlayerOptions, onDone: function([data: String]), onCancel: function([reason: String]), onInvoke: function([error: String]))
Invokes the MediaPlayer Card.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
| Parameters | |
|---|---|
| options | An object to type blackberry.invoke.card.MediaPlayerOptions describe all the options available for meida player. |
| onDone |
The callback function that will be triggered when the user finished with the media player.
data: The data string back from the media player. |
| onCancel |
The callback function that will be triggered if the user cancel the media player.
reason: A String that describes the reason the MediaPlayer was cancelled. |
| onInvoke |
The callback function that will be triggered when the media player is invoked.
error: A String that describes if there was an error. No error will be returned on success. |
Code Example:
|
static
void
blackberry.invoke.card.invokeTargetPicker
(request : Object, title : String, onSuccess: function(), onError: function())
Invokes the Target Picker Card.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
| Parameters | |
|---|---|
| request |
Object literal that specifies what to invoke. None of the fields are required. Refer to the example code for more information.
action: The action to be performed by the target. mime: MIME type of data to be acted on. If the MIME type is not specified then the mime type would be inferred from the given URI. If the MIME type cannot be inferred or URI field is empty then invocation will be rejected. uri: URI pointing to invocation data. If no URI is provided then this implies that the invocation data is provided in-band in the data field of the invocation request. data: Data (String or Blob) to be acted upon encoded based on the specified type. NOTE: If a String is passed, make sure that it does not contain unicode characters or invocation will fail. |
| title | The title string that should appear at the top of the target picker card. |
| onSuccess | a callback that is called on successfull invocation of a target. |
| onError | a callback function that will be triggered on error during the invocation process. |
Code Example:
|
Constants
static
String
CAMERA_MODE_PHOTO
Describes the photo mode for camera.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
static
String
CAMERA_MODE_VIDEO
Describes the video mode for camera.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
static
String
CAMERA_MODE_FULL
Describes the full mode for camera which means photo,video and TimeShift.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
static
String
FILEPICKER_MODE_PICKER
Describes the picker mode for the FilePicker, allows picking a file.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
static
String
FILEPICKER_MODE_SAVER
Describes the saver mode for the FilePicker, allows saving a file.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
static
String
FILEPICKER_MODE_PICKER_MULTIPLE
Describes the multiple picker mode for the FilePicker, allows picking multiple files.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
static
String
FILEPICKER_MODE_SAVER_MULTIPLE
Describes the multiple saver mode for the FilePicker, allows saving mutltiple files.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
static
String
FILEPICKER_VIEWER_MODE_LIST
Describes the list view for the viewer of the FilePicker.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
static
String
FILEPICKER_VIEWER_MODE_GRID
Describes the grid view for the viewer of the FilePicker.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
static
String
FILEPICKER_VIEWER_MODE_DEFAULT
Describes the default view for the viewer of the FilePicker.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
static
String
FILEPICKER_SORT_BY_NAME
Describes the sort by field name.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
static
String
FILEPICKER_SORT_BY_DATE
Describes the sort by field date.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
static
String
FILEPICKER_SORT_BY_SUFFIX
Describes the sort by field suffix.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
static
String
FILEPICKER_SORT_BY_SIZE
Describes the sort by field date.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
static
String
FILEPICKER_SORT_ORDER_ASCENDING
Describes the sort order of ascending.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
static
String
FILEPICKER_SORT_ORDER_DESCENDING
Describes the sort order of descending.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
static
String
FILEPICKER_TYPE_PICTURE
Describes the picture type file.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
static
String
FILEPICKER_TYPE_DOCUMENT
Describes the picture type document.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |
static
String
FILEPICKER_TYPE_MUSIC
Describes the picture type music.
| Supported Platforms | |
|---|---|
| - BlackBerry 10 | |