The Unified Data Source (UDS) library is sometimes called Hub Integration, and that's a good name for it. This library, which uses C, lets you add data from your app to the BlackBerry Hub. You can add, update, and remove custom entries that represent any data from your app that you want to display in the BlackBerry Hub. You could add alerts for events that affect your app (such as available updates), or you could simply provide another location for users to access the data in your app, without having to actually open your app at all.
Elements of the UDS library
The library is built by using several key elements, each of which can help you organize and manage the items that you add to the BlackBerry Hub:
An account represents a grouping of related items that can be displayed together in the BlackBerry Hub. If you open the BlackBerry Hub on a device, you'll notice that there are already some accounts that are predefined, such as "Notifications", "BBM", and "Text Messages". These accounts appear as tabs in the BlackBerry Hub, and you can add your own accounts to this list.
Inbox list items
An inbox list item is an individual item that appears in an account in the BlackBerry Hub. You can add data from your app as inbox list items, and you can associate these items with accounts in the BlackBerry Hub so that they're displayed on that account's tab.
A category is a grouping of items within an account. You can use categories to sort and filter inbox list items in the account. For example, a messaging account might contain folders for different types of messages, and each folder is considered a category.
An account action is an option that users can select when they view a particular account in the BlackBerry Hub. Account actions can appear in the action bar at the bottom of the screen, in the overflow menu, or in both locations.
Inbox item actions
An inbox item action is similar to an account action, but applies to the inbox list items that appear within an account in the BlackBerry Hub. Inbox item actions appear in the context menu when a user presses and holds an inbox list item.
Give me some examples, already!
Knowing how the UDS library is structured is a good place to start, but what are some typical situations where you might want to add your app's data to the BlackBerry Hub?
- A messaging app: Create an account in the BlackBerry Hub that represents your messaging app, and then add any new messages or conversations to that account as inbox list items. Your users see new message notifications for your app's account when they view the BlackBerry Hub, and they can access the messages right away.
- A game: Use an account in the BlackBerry Hub to let users know that information about your game has been changed or updated. You could alert them that someone beat their high score, or let them know that their friends are online and waiting for them to join the game.
- A productivity app: Make sure that users never miss an important entry in your app by adding reminders to an account in the BlackBerry Hub. You might remind users that their taxes are due, or prompt them to set aside their monthly contribution to their retirement fund.
To get started with the UDS library, check out the documentation in the API reference.