Data Types and Data Retrieval with BlackBerry

It seems as if everyone uses a BlackBerry these days. But not everyone organizes their information in quite the same way. If you’re going to build the programs that help people stay organized with BlackBerry devices, you need to understand the kinds of data types that users acquire, organize, and use to get through the day.

It’s safe to say that BlackBerry devices have become such a necessity for many people because as a society, we need them to help keep track of our lives. We’re busier than ever before and that doesn’t just apply to those in the business world. It’s no longer unusual to see a stay-at-home mom or dad with a BlackBerry, because they too need help managing their time and keeping track of appointments, parent teacher conferences, Little League games, etc., etc. Cell phones, though advanced in their own right, will never be able to compete with BlackBerries, if for no other reason than their unsurpassed functionality.

As a BlackBerry developer, you’re going to have to familiarize yourself with the idea of personal information management (PIM). If you’ve never heard of this concept before, basically it’s the study or practice of the things people do in order to organize, acquire, retrieve, maintain, and use informative items such as documents, web pages, e-mail messages, and text messages (among other things). Even further than that, it’s even important to figure out how a person uses those things every day in order to fulfill their role as an employee, friend, etc.

One of the goals of PIM, and hopefully one of your goals as an application developer, is to ensure that the information being utilized is not only correct, but can be found in an easily accessible location, in the right form, and of the quality needed to complete the task or meet the user’s need. Though it could almost be argued that BlackBerries are personal information managers, as they drastically reduce the amount of time and the number of errors in management-related activities, they aren’t. They do, however, feature PIM software.

The software and applications that are featured in BlackBerry devices act as an information management tool that facilitate the recording, tracking, and management of specific kinds of personal information. The most common and universal data elements found on the BlackBerry platform include addresses and contact numbers, significant calendar dates, and to-do items. Other examples include personal notes, appointments and meetings, e-mail and IM archives, among other things.

These types of data are obviously essential to the BlackBerry, thus necessary to understand. Every major mobile platform supports these data elements, as well as common desktop software. For example, BlackBerry supports Microsoft Outlook, while other smartphone devices may support different productivity application suites. Believe it or not, an entire multi-million-dollar industry of synchronization software has been brought into existence because of the difficult task of synchronizing PIM data among various data sources.

In this article we will discuss the importance of choosing the right BlackBerry development platform and how developers can interact with the PIM data directly on a BlackBerry smartphone.

Choosing a Development Platform

As mentioned previously, PIM software is featured on a BlackBerry smartphone, but it isn’t a data type. It’s a type of data — and yes, there is difference and it’s major. It’s important to discuss PIM in this article because information management is the most vital aspect of the BlackBerry, but understanding the different between PIM software and BlackBerry’s data type is of the utmost importance. So, let’s first discuss the data type utilized by BlackBerry.

{mospagebreak title=Interacting with BlackBerry’s PIM Data}

As a developer, knowing how to interact with a BlackBerry’s PIM data is important because at its core, BlackBerry is all about managing personal information. Essentially, PIM data is primarily used by three already-existing applications on a BlackBerry smartphone: the calendar application, address book, and tasks application. It is with these apps that data is entered, stored, retrieved, and manipulated.

As an example, let’s discuss the event data class in detail. This feature enables BlackBerry users to set start and end times for an event, as well as create a reminder or mark the event as recurring. This is all easy enough for the user, but how can you as a developer interact with this PIM data programmatically?

It’s important to understand that when working with BlackBerry APIs for PIM data, there are two levels of classes you should take note of. The first is called javax.microedition.pim, which is a package containing generic PIM data. Also, the classes in this particular package are usually found on devices beyond the BlackBerry and represent the core PIMItems. The supported JSR-75 contains two optional packages for features found on PDAs and other J2ME mobile devices. The first allows you to access PIM data, and the other is used to access file systems.

The second class to take note of is the net.rim.blackberry.api.pdap, which is a package containing BlackBerry-specific extensions to the javax.microedition.pim classes. Also, keep in mind that the PIMItem is a generic PIM data element, which contains a collection of data fields. PIMItems can usually be organized into a PIMList, which act as a collection of PIMItems. The location supported by a specific platform may change, because it is always determined by the PIMList where the PIMItem is stored.

The data fields inside a PIMItem can come from a variety of different data types. Some of the most common are String, String Array, Date, boolean, integer, and last but not least, binary. Each of these PIMItem classes includes “getters” and “setters,” which are used to manipulate the data. Each and every field will include a descriptive label, zero or more data levels, data value attributes, and a specific data type. These field names are then even further categorized by integer values that will be determined by the contact, event, and to-do classes.

{mospagebreak title=Retrieving PIM Data}

As we’ve already discussed, PIMItems are stored in a device’s PIMLists. Sometimes, on rare occasions, there may be multiple PIMLists on a device, but usually there’s nothing more than a single default list of PIM data. In order to access the lists of PIM data, you have to obtain a reference to the PIM database.

There are also different methods you can employ once you’ve accessed the database. The static method retrieves an example of the PIM database, which is actually necessary for any further operations. This particular class also includes methods for opening up PIMLists that are already in existence. Here, you can also serialize a PIMItem to an input (our output) stream.

There are also two openPIMList methods, with one opening the default PIMList and the other taking a String argument for a named PIMList. The listPIMLists method enables a developer to obtain a list of available PIMList names, and it returns a String array containing a PIMList name in each array element.

As we discussed earlier, it’s very important to note data types in the BlackBerry Java API documentation. Despite which openPIMList method is used, there are two arguments that are necessary: pimListType, which may be CONTACT_LIST, EVENT_LIST, or TODO_LIST; and mode, which may be READ_ONLY, WRITE_ONLY, or READ_WRITE. Once a developer has the PIMList open, the application can access the elements by employing an enumeration.

Sure, developing applications for BlackBerry may be your forte, but understanding the data types employed by BlackBerry is also essential to understanding how the smartphone device works.

Google+ Comments

Google+ Comments