Search code examples
usbkioskgoogle-chrome-os

chrome os kiosk load content from usb


I am new to Chrome OS and have written a NFC enabled kiosk app and installed it on my managed Chromebit so that it enters kiosk mode on boot. This is working well.

I would now like to have the kiosk app load html files from an external usb device rather than the cloud due to large files, video etc. something like webview src=files://USB Drive/Video1/index.html is what I have in mind.

I have read up on the fileSystem API and that it is supported for kiosk apps running in kiosk mode, which my app is, but I cannot get it to work.

The below code results in the error shown.

chrome.fileSystem.getVolumeList( function(volumes){

if (volumes === undefined)
{
    log("Error: " + JSON.stringify(chrome.runtime.lastError));
}
else
{
    $.each(volumes, function(i, v){
        log("Volume: " + v.volumeid + ", Writable: " + v.writable);
    });

    // Request Filesystem
    log("Requesting filesystem...");
    chrome.fileSystem.requestFileSystem(volumes[0].volumeid, function(fs) {

        if (fs === undefined)
        {
            log("Error: " + JSON.stringify(chrome.runtime.lastError));
        }
        else
        {
            log(JSON.stringify(fs));
        }
    });
}

});

and the error:

Error: {"message":"Operation only supported for kiosk apps running in a kiosk session."}

My app is a kiosk app running in a kiosk session!

My manifest is as follows:

{ "name": "****",

"version": "0.1",

"description": "****",

"manifest_version": 2,

"icons": {

  "128": "icon_128.png",

  "16": "icon_16.png"

},

"permissions": [

"usb",

{

  "usbDevices": [

    { "vendorId": 1839, "productId": 8704 } // This is the NFC USB reader

  ]

},

"webview",

"audio",

"enterprise.deviceAttributes",

"power",

"unlimitedStorage",

{"fileSystem": ["write", "retainEntries", "directory", "requestFileSystem"] }

],

"app": {

"background": {

  "scripts": [ "background.js" ]

}

},

"kiosk_enabled": true

}

Any help on getting my kiosk app to load html content from an external USB would be greatly appreciated.


Solution

  • You need to add "kiosk_only": true in the manifest file.