Personal information management

Personal information management (PIM) refers to the ability to add, modify, and delete information that's specific to a particular user on a BlackBerry device. Users often want to store and track information that helps them organize their personal and professional lives. This information might include calendar entries, contacts, notes, and other personal items. Users want quick and easy access to this information anywhere they go.

BlackBerry 10 includes several core applications that can help you manage your personal information. Many of these apps provide features that users have come to expect from modern smartphones. The Calendar application lets you keep track of meetings, appointments, and so on, while the Contacts application gives you a central location to store information for all of your personal and professional contacts. BlackBerry 10 also includes other PIM apps, such as the Remember application, which lets you store a set of notebooks where you can add tasks and other list-type information.

Screens showing the Calendar, Contacts, and Remember applications.

There are APIs that you can use to interact with each PIM app. These APIs are available only in C++ (not QML), and they let you add, remove, and modify PIM entries directly from your own app. For example, you can use the Contacts API to add new contacts to the Contacts application, and specify properties (such as addresses and photos) for these contacts. Each of these APIs is structured similarly, which makes it easier for you to learn how to interact with them in your apps.

Service classes

Each PIM API consists of several classes that are used to represent the data for the corresponding PIM app. For example, the Contacts API includes classes such as  Contact, ContactOnlineStatus ContactPhoto, and so on. You can use these classes to specify the details of a particular entry in the app. The Contact class represents a single contact, the ContactPhoto class represents the photo that's associated with a contact, and so on.

Most PIM APIs also include a service class, which is identified with the suffix "Service" (such as ContactService). These service classes provide access to the corresponding database on the device, and you use these classes when you want to perform an operation on data in the database. For example, consider the ContactService class. This class lets you add new contacts to the database of contacts on the device (by using  createContact()), update the entries of existing contacts (by using  updateContact()), and delete a contact (by using  deleteContact()).

When you want to manipulate PIM entries, you need to create an instance of the appropriate service class. Then, you can create your new entries, update the information in existing entries, and perform any other operations you want. Finally, when you want to update the entries in the database, you call the functions of the service object that you created. It's important to remember that PIM entries aren't added to, updated in, or deleted from the database until you call one of the functions of the service object. This behavior lets you populate as much of the information for a PIM entry as you want, and then commit the changes when you're ready. This behavior also improves performance, because your app isn't accessing the PIM database whenever a small piece of information is updated.

Diagram showing how a PIM service object is used to manipulate PIM entries.

Creating the service object efficiently

It can be expensive, in terms of both memory consumption and processing cost, to create the service objects that your app needs to interact with the corresponding databases. You should avoid creating service objects every time you need to perform operations on the database. Instead, try to create the object only once and use the same object throughout your app.

To learn how to use the different PIM APIs, check out the links below.

Last modified: 2013-12-21

comments powered by Disqus