uds_register_item_context_action()

Register an item context action for an existing account that's registered with the BlackBerry Hub.

Synopsis:

int uds_register_item_context_action(uds_context_t handle,
                                     uds_account_key_t accountId,
                                     const uds_item_action_data_t *pItem)

Since:

BlackBerry 10.2.0

Arguments:

handle

The handle that's associated with your app's registration with the BlackBerry Hub.

accountId

The account key of the existing account to register the item context action for, as a uds_account_key_t.

pItem

The item context action to register. This item action is represented by a uds_item_action_data_t and contains all of the information that's required to display and invoke the action based on the state of an inbox list item in the BlackBerry Hub.

Library:

libunifieddatasourcec (For the qcc command, use the -l unifieddatasourcec option to link against this library)

Description:

This function registers an item context action for an existing account that was added to the BlackBerry Hub using uds_account_added(). If the item context action is registered successfully (that is, this function returns UDS_SUCCESS), the data from the action populates the context menu when an inbox list item is selected in the account view in the BlackBerry Hub.

Here's an example of how to create and populate a globally defined item context action, and then register the action with the BlackBerry Hub:

 typedef enum{
     ReadAction = 0x01<<0,
     UnreadReadAction = 0x01<<1,
     AcceptAction = 0x01<<2
 }ActionState;
 
 // The udsHandle variable below is the handle that your app obtains by
 // calling uds_init()
 int retVal = -1;
 uds_item_action_data_t *item_action = uds_item_action_data_create();
 uds_item_action_data_set_action(item_action,"bb.action.ACCEPT");
 uds_item_action_data_set_target(item_action,"UDSTestApp");
 uds_item_action_data_set_type(item_action,"service");
 uds_item_action_data_set_title(item_action,"Accept Request");
 uds_item_action_data_set_image_source(item_action,"uds_accept.png");
 uds_item_action_data_set_mime_type(item_action,mime_type);
 uds_item_action_data_set_placement(item_action,
         "application/vnd.blackberry.socialconnect.UDSTestApp.notification");
  uds_item_action_data_set_context_mask(item_action,AcceptAction);
 if (UDS_SUCCESS!= (retVal = uds_register_item_context_action(udsHandle, 1 ,
                                                              item_action)))
 {
   printf("uds_register_item_context_action failed with error %d\n", retVal);
 }

Returns:

UDS_SUCCESS if the item context action was registered successfully, or a non-zero error code on failure. See uds_error_code_t or errno.h for details.

Last modified: 2015-01-22



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus