| ID | CS001221 | 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.Import() |
The following code snippet demonstrates how to use the Contact Service API in a Flash Lite 3.0 application to import a contact from the VCard file to the phonebook (supported from S60 5th Edition onwards).
// Import Platform Service Interface
import com.nokia.lib.Service;
// Heading of the application
heading_txt.text = "Import Contact";
// Create a new Service object which has Calendar data
var contact = new Service("Service.Contact", "IDataSource");
// Define the VCrad file for import
var inputData = {SourceFile:"c:\\Data\\Others\\contact.vcf"};
// Define input parameters
var inParams = {Type:"Contact", Data:inputData};
// Define result value
var outParams = contact.Import(inParams);
// Check if Import is successful
if (outParams.ErrorCode == 0) {
text_txt.text += "Import success!";
} else {
var errorId = outParams.ErrorCode;
text_txt.text += "\rError: "+errorId;
}
Note: To perform a successful contact import with this application you need to have a contact.vcf file which includes valid VCard format data at the location c:\\Data\\Others\\contact.vcf.
Imported contact information (Eric Example) can be found from the default phonebook of the device.
The following sample application has been tested in Nokia 5800 XpressMusic (S60 5th edition, Flash Lite 3.0).
File:FlashLite Import Contact.zip