| ID | CS001290 | Creation date | January 26, 2009 |
| Platform | S60 5th Edition | Tested on devices | Nokia 5800 XpressMusic |
| Category | Flash Lite | Subcategory | Location |
| Keywords (APIs, classes, methods, functions): Service.Landmarks, landmark.Import() |
This code snippet demonstrates how to import landmarks from the file using the Landmarks Platform Service for Flash Lite supported from S60 5th Edition onwards.
Note: To import landmarks with this application you need to have copied a landmarks file (landmarks.lmx ) in the folder c:\Data\\Others\ on your device.
// Import Platform Service Interface
import com.nokia.lib.Service;
// Heading of the application
heading_txt.text = "Importing landmarks";
text_txt.text = "Press the Import button to import landmarks from " +
"c:\\Data\\Others\\landmarks.lmx";
// Create new Service object which has Landmark information
var landmark = new Service("Service.Landmarks", "IDataSource");
/**********************************************************
** Function for pressing the Import button.
** Calls Import() method synchronously.
** Method imports landmarks from the file
**********************************************************/
import_mc.onPress = function() {
text_txt.text = "Imported landmarks:\r";
// Define input parameters
var inputData = {
SourceFile:"c:\\Data\\Others\\landmarks.lmx",
MimeType:"application/vnd.nokia.landmarkcollection+xml"
};
var inParams = {Type:"Landmark", Data:inputData};
// Define result value
var outParams = landmark.Import(inParams);
var outList = outParams.ReturnValue;
var i = 0;
if (outParams.ErrorCode == 0) {
var outputEntry = null;
do {
i++;
outputEntry = outList.next();
if (null != outputEntry) {
text_txt.text += "Landmark "+i+"\r"+outputEntry.LandmarkName+
"\r"+outputEntry.id+"\r";
} else {
break;
}
} while (true);
} else {
var errorId = outParams.ErrorCode;
text_txt.text = "Error while importing: "+errorId;
};
};
Imported landmarks are displayed. Landmarks can be imported by pressing the Import button.
The following sample application has been tested in the Nokia 5800 XpressMusic (S60 5th Edition, Flash Lite 3.0). File:FlashLite Importing Landmarks.zip
No related wiki articles found