Archived:Checking memory card availability in Flash Lite
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.
Article Metadata
Code Example
Source file: Media:FlashLite Checking Memory Card Existence.zip
Tested with
Devices(s): Nokia 5800 XpressMusic
Compatibility
Platform(s): S60 5th Edition
Article
Keywords: Service.SysInfo, sysInfo.GetInfo()
Created: User:Nokia Developer KB
(26 Jan 2009)
Last edited: hamishwillee
(03 Oct 2012)
Contents |
Source
// 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;
}
Postconditions
Status of the memory card is displayed (disabled/enabled).
Example application
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

