| ID | CS001280 | Creation date | January 26, 2009 |
| Platform | S60 5th Edition | Tested on devices | Nokia 5800 XpressMusic |
| Category | Flash Lite | Subcategory | Hardware |
| Keywords (APIs, classes, methods, functions): Service.SysInfo, sysInfo.GetInfo() |
This code snippet demonstrates how to check if there is a memory card using the SystemInfo Platform Service for Flash Lite supported from S60 5th Edition onwards.
// Import Platform Service Interface
import com.nokia.lib.Service;
// Heading of the application
heading_txt.text = "Checking Memory card existence";
// Create new Service object which has SystemInfo Service data
var sysInfo = new Service("Service.SysInfo", "ISysInfo");
// Define input parameters
var inParams = {Entity:"Memory", Key:"MemoryCard"};
// Retrieve information about a system attribute with a synchronous call
// Define result value
var outParams = sysInfo.GetInfo(inParams);
if (outParams.ErrorCode == 0) {
var systemData = outParams.ReturnValue;
var memoryCard = systemData.Status;
if(memoryCard == 1) {
text_txt.text = "Memory Card: Enabled";
} else {
text_txt.text = "Memory Card: Disabled";
}
} else {
var errorId = outParam.ErrorCode;
text_txt.text = "Error: "+errorId;
}text_txt.text = "Error: "+errorId;
}
Status of the memory card is displayed (disabled/enabled).
The following sample application has been tested in the Nokia 5800 XpressMusic (S60 5th Edition, Flash Lite 3.0).
File:FlashLite Checking Memory Card Existence.zip
No related wiki articles found