Categories: Java | Porting | Code Examples | PIM
This page was last modified 06:00, 27 November 2007.
Porting considerations while using PIM
From Forum Nokia Wiki
/** * 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() == true) 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; }
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Connection problem! | Kennneth | Mobile Java General | 10 | 2006-06-07 02:13 |
| III edition porting problem | vivek_mics | Porting Symbian C++ to S60 | 1 | 2006-08-28 04:24 |
| Access message Inbox and Sent Item folders. | CogitoErgoSum | Mobile Java Networking & Messaging & Security | 6 | 2008-01-08 04:46 |
| PC suite and Free PIM tools. | gotan | PC Suite API and PC Connectivity SDK | 5 | 2008-04-18 16:07 |
| PIM access (s40/s60) | vichoty | Mobile Java General | 1 | 2005-12-20 11:10 |
