UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    write file and read, works on emulator.

    Scheduled Pinned Locked Moved App Development
    6 Posts 2 Posters 849 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • 0 Offline
      007fred50
      last edited by

      Hello,

      I try to create a file, i works on Emulator but not on real device (Ubuntu touch)

      Code:

      function openFile(fileUrl) {
              var request = new XMLHttpRequest();
              request.open("GET", fileUrl, false);
              request.send(null);
              return request.responseText;
      }
      
          function saveFile(fileUrl, text) {
              var request = new XMLHttpRequest();
              request.open("PUT", fileUrl, false);
              request.send(text);
              return request.status;
          }
      

      Do i need some permission to allow write to file?

      1 Reply Last reply Reply Quote 0
      • lduboeufL Offline
        lduboeuf
        last edited by

        What kind of error do you have ?

        0 1 Reply Last reply Reply Quote 0
        • 0 Offline
          007fred50 @lduboeuf
          last edited by

          @lduboeuf How can i see the error?

          I can't see the error

          lduboeufL 1 Reply Last reply Reply Quote 0
          • lduboeufL Offline
            lduboeuf @007fred50
            last edited by lduboeuf

            @007fred50 if you use clickable to dzploy your app, just do clickable logs.
            But you can't write files everywhere, only in your app namespace, that is in /home/phablet/local/share/yourappnamespace

            You can find app logs in .cache/upstart/

            0 1 Reply Last reply Reply Quote 0
            • 0 Offline
              007fred50 @lduboeuf
              last edited by

              @lduboeuf There are not (local), but i found (.local)

              cd /home/phablet/.local/share/ (no namespace)

              All what i want is save variable to next login to the app..

              i found this here (Storage) can i use that? instead of write a file

              lduboeufL 1 Reply Last reply Reply Quote 0
              • lduboeufL Offline
                lduboeuf @007fred50
                last edited by

                @007fred50 yes i think storage is better

                1 Reply Last reply Reply Quote 0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • First post
                  Last post