| ID | CS001223 | Creation date | December 15, 2008 |
| Platform | S60 5th Edition | Tested on devices | Nokia 5800 XpressMusic |
| Category | Flash Lite | Subcategory | S60 Platform Services |
| Keywords (APIs, classes, methods, functions): Service.Contact, contact.GetList() |
The following code snippet demonstrates how to use the Contact Service API in a Flash Lite 3.0 application to list contacts of the default phonebook (supported from S60 5th Edition onwards).
// Import Platform Service Interface
import com.nokia.lib.Service;
// Heading of the application
heading_txt.text = "List Contacts (firstname)";
// Create a new Service object which has Contact data
var contact = new Service("Service.Contact", "IDataSource");
// Define input parameters
var inParams = {Type:"Contact"};
// Define the result value
var outParams = contact.GetList(inParams);
if (outParams.ErrorCode == 0) {
var outList = outParams.ReturnValue;
var outputEntry = null;
do {
outputEntry = outList.next();
if (null != outputEntry) {
// Get firstname of the contact and trace it to the textfield
var firstname = outputEntry.FirstName["Value"];
text_txt.text += "-"+firstname+"\r";
} else {
break;
}
} while (true);
} else {
// if errors, copy them to the textfield
var errorId = outParams.ErrorCode;
text_txt.text += "Error: "+errorId;
}
All contacts of the default phonebook are displayed.
The following sample application has been tested in Nokia 5800 XpressMusic (S60 5th edition, Flash Lite 3.0).
File:FlashLite List Contacts.zip