I am developing an app that uses the chrome.storage.managed
api to manage the app settings, which means that by design end users will not be able to edit their own settings, they will require their network administrator to do so.
However, I would like to set up an efficient developer workflow, which ideally would involve avoiding any kind of managed chromebook administration. I know I can use developer mode on the Chromebook to access the actual file system, but not what to do with it. So, my question is how do I use the ChromeOS file system to store a particular JSON blob in the managed storage for a Chrome extension of my choosing?
Chrome OS reads policies for extensions and apps from the /etc/opt/chrome/policies/managed/
directory. If you save a JSON file in that directory (you may have to create if it doesn't exist) with the correct format using your app's id, that policy will be set and the settings will be available via the chrome.storage.managed
API.
Here is an example of the JSON format:
{
"3rdparty": {
"extensions": {
"aapbdbdomjkkjkaonfhkkikfgjllcleb": {
"foo": "bar"
}
}
}
}
Note: this is different from the format used when uploading to the Google admin console for setting managed storage remotely, that would look like this:
{
"foo": {
"Value": "bar"
}
}
Once you save your JSON file go to chrome://policy/
in the device's browser, you'll be able to see if the policy is being set for your app, and what the values are.
This page is extremely helpful if you need more information.