Porting considerations while using PIM

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Created: User:Soku123 (01 Jun 2007)
Last edited: hamishwillee (26 Jul 2013)
* Test if the PIM API is supported.
* @return true if the PIM API is supported, false otherwise

static public boolean isPimApiSupported() {
boolean isSupported = true;
String pimApiVersion =
if (pimApiVersion == null) {
isSupported = false;
return isSupported;
// Test if PIM API is supported
if (isPimApiSupported())
System.out.println("PIM API IS supported");
System.out.println("PIM API is NOT supported");

Not all PIM database types (ContactList, EventList, ToDoList) might be supported on a given handset PIM implementation; note that the PIM API specification only mandates support for one of the types. Call the method PIM.openList(int listType, mode) to test if a specific list type is supported. The following code snippet shows how to test if the calendar events database is supported:

* Helper method to test if calendar events database types are supported.
* @return true if calendar/events databases are supported, and false
* if event databases are not supported or if permission to use use the
* PIM API is denied.

static public boolean isEventListSupported() {
boolean retVal;
EventList el = null;
try {
// Try to open the event list; this will tell us if it is supported
el = (EventList) pim.openPIMList(PIM.EVENT_LIST, PIM.READ_WRITE);
retVal = true;
} catch (SecurityException e) {
retVal = false; // Unknown since access to API was denied
} catch (PIMException e) {
retVal = false;
} finally {
if (el != null) {
try {
// Close the event list since we only opened it to
// see if it is supported.
} catch (PIMException ignore) {
// ignore
return retVal;
This page was last modified on 26 July 2013, at 06:17.
34 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.