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

Web and WebWorks Development

Reply
New Developer
Posts: 13
Registered: ‎12-03-2009
My Device: Not Specified

Error using SD card program given on the blackberry site

I have taken the code from

 

http://na.blackberry.com/eng/developers/devbetasoftware/widgetsdk.jsp

 

and used the exact same thing. I am getting errors in my js file saying the functions blackberry.io.file.exists(filePath), blackberry.io.file.readFile(filePath, readFile), blackberry.io.file.deleteFile(filePath), blackberry.io.file.saveFile(filePath, blob) are unresolved.

 

But my program is getting compiled correctly and the simulator is up and running. When I open the application and click on the open file item in the menu item I see this error on my eclipse console :

 

net.rim.device.api.io.file.FileIOException: File system error (1003)
    Running  at line    5: if(blackberry.io.file.exists(filePath) ){.

 

Can you tell me why I am seeing this error?

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Error using SD card program given on the blackberry site

Have you added the following feature element to your config.xml

 

 

<feature id="blackberry.io.file" version="1.0.0"/>

 

 

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Developer
Posts: 13
Registered: ‎12-03-2009
My Device: Not Specified

Re: Error using SD card program given on the blackberry site

yes I have included that in the config file. my config looks like this:

 

<?xml version="1.0" encoding="utf-8" ?>

<widget xmlns="http://www.w3.org/ns/widgets"
        xmlns:rim="http://www.blackberry.com/ns/widgets"
        version="1.0.0">

  <name>File IO Example</name>

  <description>Storing and retrieving data from a file on the local SD card</description>

  <author href="http://www.rim.com/" rim:copyright="no copyright" email = "webapi@rim.com">
    Research in Motion - Web API Team
  </author>

  <license href="http://www.license.com">This is a sample license</license>

  <content src="index.html" />

  <feature id="blackberry.system" />
  <feature id="blackberry.ui" />
  <feature id="blackberry.ui.menu" />
  <feature id="blackberry.utils" />
  <feature id="blackberry.io.file" />

</widget>

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Error using SD card program given on the blackberry site

Is the file path being used valid?  Also in the simulator have you simulated an SD card in the device?

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Developer
Posts: 13
Registered: ‎12-03-2009
My Device: Not Specified

Re: Error using SD card program given on the blackberry site

I am new to blackberry widgets. I have installed the eclipse webplugin from the blackberry site(the full installer) and it gave me a simulator 9500.

 

I have just realised that when I go to the Change Sd card option on the blackberry simulator, I see that there is no simulator currently. How I simulate an SD card in the device and set the file path. I am sorry for too many questions.

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Error using SD card program given on the blackberry site

If you check out the "Simulator Help Index" on the simulator's help menu you can check out the following topic:

 

"BlackBerry Smartphone Simulator -> Simulating Device operating conditions -> Simulate a media card"

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Developer
Posts: 13
Registered: ‎12-03-2009
My Device: Not Specified

Re: Error using SD card program given on the blackberry site

I have made a new directory as the media card and called it New Folder.

 

Now i changed the filepath in my code as

 

var filePath = "C:/Program Files/BlackBerry Web Plug-in Eclipse/plugins/net.rim.browser.tools.wcpc_1.0.0.200910291414-35/wcpc/simpack/New Folder/myDataFile.txt";
var backupPath = "C:/Program Files/BlackBerry Web Plug-in Eclipse/plugins/net.rim.browser.tools.wcpc_1.0.0.200910291414-35/wcpc/simpack/New Folder/myDataFile2.txt";

 

I run this code on the simulator, and said Open file from the menu item and it is showing me this error:

 

javax.microedition.io.ConnectionNotFoundException: Protocol not found: net.rim.device.cldc.io.c.Protocol
    Running  at line    5: if(blackberry.io.file.exists(filePath) ){.

 

 

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Error using SD card program given on the blackberry site

You will need to use a local path on the device.  Check out the following post to give you some details:

http://supportforums.blackberry.com/t5/Java-Development/File-Operations-on-simulator/m-p/246742

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Developer
Posts: 13
Registered: ‎12-03-2009
My Device: Not Specified

Re: Error using SD card program given on the blackberry site

I read the link you have mentioned and followed their steps.

I have a new directory created called New Folder (created this using the Change the SD Card option in the simulator menu). And we run the code using this:

 

var filePath = "file:///SDCard/myDataFile.txt";
var backupPath = "file:///SDCard/myDataFile2.txt";

 

The error is:

net.rim.device.api.io.file.FileIOException: File system error (1003)
    Running  at line   19: if(blackberry.io.file.exists(filePath) ){.

 

 

I also tried using

 

var filePath = "file:///SDCard/New Folder/myDataFile.txt";
var backupPath = "file:///SDCard/New Folder/myDataFile2.txt";

 

I see the same error again.

 

I also tried

var filePath = "file:///C:/Program Files/BlackBerry Web Plug-in Eclipse/plugins/net.rim.browser.tools.wcpc_1.0.0.200910291414-35/wcpc/simpack/New Folder/myDataFile.txt";
var backupPath = "file:///C:/Program Files/BlackBerry Web Plug-in Eclipse/plugins/net.rim.browser.tools.wcpc_1.0.0.200910291414-35/wcpc/simpack/New Folder/myDataFile2.txt";

 

but I am getting the same error.

 

Please tell me where we are going on.

 

 

 

 

 

New Developer
Posts: 13
Registered: ‎12-03-2009
My Device: Not Specified

Re: Error using SD card program given on the blackberry site

Can someone please help asap, I have a submission of the project today...