Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Porting considerations while using PIM

From Wiki
Jump to: navigation, search
Article Metadata
Article
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 =
System.getProperty("microedition.pim.version");
if (pimApiVersion == null) {
isSupported = false;
}
return isSupported;
}
 
:
 
// Test if PIM API is supported
if (isPimApiSupported())
System.out.println("PIM API IS supported");
else
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.
el.close();
} catch (PIMException ignore) {
// ignore
}
}
}
return retVal;
}
This page was last modified on 26 July 2013, at 06:17.
40 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.

×