How to use the RuntimeApi in HTML5 Apps?



  • 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).


  • Banned

    This post is deleted!

Log in to reply