Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8949113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:09:53+00:00 2026-06-15T13:09:53+00:00

I have two applications I’m loading on a BlackBerry, one is a native application,

  • 0

I have two applications I’m loading on a BlackBerry, one is a native application, the other is a PhoneGap / Cordova based application.

These two applications share a settings file: file:///store/home/user/myfile.txt

To access this file via Cordova, I call:

fileSystem.root.getFile("home/user/myfile.txt", null, gotFileEntry, fail);

However, on some devices fileSystem.rootreturns the SDCard directory, not the internal memory where the file is stored, so I get a FileNotFound error.

I’ve tried calling fileSystem.root.getParent(gotParent, fail);, hoping to get the root of the filesystem, then get the file from internal memory like so:

parentDir.getFile("store/home/user/myfile.txt", null, gotFileEntry, fail);

But that doesn’t work either, I still receive a file not found error.

How can I get the root directory of the internal memory every time, using PhoneGap/Cordova?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:09:54+00:00Added an answer on June 15, 2026 at 1:09 pm

    What version of Cordova do you use?
    Cordova File-API is supported since BlackBerry WebWorks (OS 5.0 and higher).

    Am I right in the assumption that you only want to read (and write) that file?
    If so you can try to use the Cordova File-Reader and the Cordova File-Writer.

    FileReader

    function win(file) {
        var reader = new FileReader();
        reader.onloadend = function(evt) {
            console.log("read success");
            console.log(evt.target.result);
        };
        reader.readAsText(file);
    };
    
    var fail = function(evt) {
        console.log(error.code);
    };
    
    entry.file(win, fail);
    

    FileWriter

    function win(writer) {
        writer.onwrite = function(evt) {
            console.log("write success");
        };
        writer.seek(writer.length);
        writer.write("appended text");
    };
    
    var fail = function(evt) {
        console.log(error.code);
    };
    
    entry.createWriter(win, fail);
    

    Otherwise give that snippet a try (code is of an old project but worked at that time)

    <script type="text/javascript" charset="utf-8" src="css-js/phonegap-1.0.0.js"></script>
    <script type="text/javascript" charset="utf-8">
    
    // Wait for PhoneGap to load
    //
    document.addEventListener("deviceready", onDeviceReady, false);
    
    // PhoneGap is ready
    //
    function onDeviceReady() {
        window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
    
    }
    
    function gotFS(fileSystem) {
        var path = "readme.txt";
        fileSystem.root.getFile(path, {create: true, exclusive: false}, gotFileEntry, fail);
    
    }
    
    function gotFileEntry(fileEntry) {
    
        fileEntry.createWriter(gotFileWriter, fail);
    }
    
    function gotFileWriter(writer) {
        writer.onwrite = function(evt) {
            console.log("write success");
        };
        writer.write("some sample text");
    

    I hope I could help you, best regards
    F481

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two applications. One is a legacy webapp which is servlet-based. The other
I have two applications, one is the main application and the other is a
I have two separated applications, one written in Java and other in Erlang. Both
I have two applications. One is the server app and the other is the
I have two applications, one for android and one for blackberry and I want
I have two applications. In one application the web browser control shows a flash
We have two applications running on single machine,one of which is web application that
we have two applications, a native C++ application and a managed C#/WPF UI that
I have I have two applications. I have a menu button on one application
I have two applications. One is a receiver and its starting my application. It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.