Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

BlackBerry® World™ Development

Reply
Contributor
redimedic
Posts: 30
Registered: ‎09-13-2011
My Device: Tourch
Accepted Solution

App failed to detect SDCard on simulator 4.6.1 and above

Hello Everyone,

 

I am testing my app on 4.6.1 8900 simulator.My app has a check as follows:

// Determines if an SD card is installed
public static boolean hasSDCard() {

Enumeration efs = FileSystemRegistry.listRoots();
while (efs.hasMoreElements()) {
String root = (String) efs.nextElement();
if (root.equalsIgnoreCase("sdcard/")) {
return true;
}
}
return false;
}

 

I have created a memoery card named as sdcard-sdcard.dmp at location

C:\Eclipse\plugins\net.rim.ejde.componentpack4.6.1_4.6.1.49\components\simulator

 

BUt my application, is not able to detect the SDCard.

 

Not sure where im wrong.?Do i need to create SDcard at any other location?

 

The code works fine with 4.5 simulator....

 

Please guide.

 

~Priyanka

Developer
smiley
Posts: 1,497
Registered: ‎07-14-2008
My Device: Z10

Re: App failed to detect SDCard on simulator 4.6.1 and above

Stupid question. Did you actually mount the SD card in the SIM?

Contributor
redimedic
Posts: 30
Registered: ‎09-13-2011
My Device: Tourch

Re: App failed to detect SDCard on simulator 4.6.1 and above

Firstly no question is stupid. What do you meant by mount SD card in the SIM?
I would be thankful if you can explain the steps also.

As I have mentioned, I have created a memory card. Steps followed are
Simulate -. Change SD card -> Add file -> NOw added file named sdcard-sdcard.dmp at the location C:\Eclipse\plugins\net.rim.ejde.componentpack4.6.1_4.6.1.49\components\simulator

DO let me know how should proceed further. Guidance is appreciated.

~Priyanka
Developer
QuiteSimple
Posts: 1,452
Registered: ‎11-06-2009
My Device: Torch 9810

Re: App failed to detect SDCard on simulator 4.6.1 and above

I use slightly different code to detect SDcard but I guess yours is OK too

 

    public static boolean hasMediaCard()
    {        
        Enumeration e = FileSystemRegistry.listRoots();
        while (e.hasMoreElements()) 
        {
            String root = (String) e.nextElement();
            if (root.startsWith("SDCard"))
                return true;
        }        
        return false;
    }

 As for the SDCard - try to create a dir in simulator folder, the name of the dir "SDCard". Start simulator, menu Simulate, Change SD Card..., select the already created dir, you should receive a message at that point that MediaCard is inserted.

 

And please for future questions use the Java Development forum, you will get more responses there :smileywink:



"When you become a level 3 developer, you learn to communicate over the ether. I'm told that level 5 developers are ascend into a higher level of existence beyond the physical realm." gord888 @ crackberry
Contributor
redimedic
Posts: 30
Registered: ‎09-13-2011
My Device: Tourch

Re: App failed to detect SDCard on simulator 4.6.1 and above

Thanks, Adding SDCard Folder (rather then the *-sdcard.dmp file) worked for me.
None of the blackberry doc emphasis that directory needs to be created to simulate SDcard!!

I have having one issue now,every time I start the simulator for debugging I need to add the SDcard.Is there any way to set the SDcard configuration as default?
Developer
smiley
Posts: 1,497
Registered: ‎07-14-2008
My Device: Z10

Re: App failed to detect SDCard on simulator 4.6.1 and above

you must change sd card manually on every reset for sims less than OS7.  On OS7 you do not need this. it auto mounts the sd card on resets

Developer
QuiteSimple
Posts: 1,452
Registered: ‎11-06-2009
My Device: Torch 9810

Re: App failed to detect SDCard on simulator 4.6.1 and above

Actually it is possible, but requires some manual adjustment

 

If you use the BB IDE - Edit - Preferences - Simulator - Memory, check options "Simulate SDCard insert", "Use PC file system for SD Card" and browse to the specific SDCard folder.

 

Another option is to edit the simulator .bat file and to add those parameters

/sdcard-inserted=true /fs-sdcard=true /fs-sdcard-root="<my folder goes here>"

for example

/sdcard-inserted=true /fs-sdcard=true /fs-sdcard-root="F:\Research In Motion\BlackBerry Smartphone Simulators 5.0.0\5.0.0.1076 (9300)\SDCard"

 

No idea how it is with Eclipse though



"When you become a level 3 developer, you learn to communicate over the ether. I'm told that level 5 developers are ascend into a higher level of existence beyond the physical realm." gord888 @ crackberry