跨单个应用程序信息亭模式执行持久化数据

跨单个应用程序信息亭模式执行持久化数据

本文介绍了跨单个应用程序信息亭模式执行持久化数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开发普通的Chrome应用时,我使用 Chrome存储API 来保留键值对跨会话.这很好用,我想对单应用信息亭模式执行相同的操作要在托管的Chrome设备上部署的应用程序.但是,chrome.storage.local似乎并没有在应用程序的整个执行过程中持续存在.

When developing normal Chrome Apps, I use the Chrome storage API to persist key-value pairs across sessions. This works great, and I want to do the same for a Single App Kiosk Mode app to be deployed on managed Chrome devices. However, it seems that chrome.storage.local does not persist across executions of the app.

我写了一个测试应用来说明此问题.代码此处.

I wrote a test app illustrating this issue. Code here.

推荐答案

注意:此答案仅适用于Chrome管理控制台的用户

事实证明,问题与Chrome管理控制台中的设置有关.在设备设置下,用户数据"选项应为不清除所有本地用户数据".我已将其设置为擦除所有本地用户数据",这在每次重新启动时都会擦除我的localStorage.我没有仔细查看该选项,因为我发现Single App Kiosk Mode存在于用户会话之外,因此没有要删除的用户数据.

It turns out the issue had everything to do with a setting in the Chrome Management Console. Under Device Settings, the "User Data" option should be "Do not erase all local user data." I had set it to "Erase all local user data," which wiped out my localStorage with each reboot. I didn't look at that option closely since I figured Single App Kiosk Mode existed outside of a user session, so there was no user data to erase.

这篇关于跨单个应用程序信息亭模式执行持久化数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 02:16