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

    How to use the RuntimeApi in HTML5 Apps?

    Scheduled Pinned Locked Moved App Development
    2 Posts 2 Posters 598 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.
      • WendigoW Offline
        Wendigo
        last edited by Wendigo

        Hi Community,
        I'm developing an HTML5 game and would like to access the file system for storing my save games. (Unfortunately I can't use the localStorage since the reboots caused by the memory bug on the Fairphone2 sometimes erase the stored data)
        In the docs I found an article about the RuntimeApi which contains a function called "getApplicationWritableLocation". So I assume that it is possible to access the filesystem via JavaScript from within the HTML5 App. I have never accessed the Ubuntu Touch specific API before and the documentation is scarce. So I'm a little lost.

        String getApplicationWritableLocation() Retrieves the fileystem location where the application is allowed to write its data in.
        

        https://api-docs.ubports.com/sdk/apps/html5/RuntimeApi/RuntimeApi.html

        My questions:

        • How do I access the API in the first place. Do I need to require/import something or can I just access the "external" object?
          This is the example from the doc page above:
        var api = external.getUnityObject('1.0');
            api.RuntimeApi.getApplication(function(application) {
              console.log('Application name: ' + application.getApplicationName());
            });
        
        • Where can I find information about the actual function that can read/write to the path retrieved by "ApplicationWritableLocation"?

        Many thanks in advance

        Edit:
        After a little research I found this old site from Ubuntu that references Apache Cordova which indeed has a File API:
        https://docs.ubuntu.com/phone/en/apps/html-5/api
        But unfortunately they dropped Ubuntu support last year. 😞
        Looks like I really need to use the functionality from the RuntimeApi from Ubuntu Touch (if there is one at all).

        1 Reply Last reply Reply Quote 1
        • L Offline
          L-00081 Banned
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • First post
            Last post