我已经构建了Cordova App (cordova -v 7.0.1,cordova-android 6.1.0)。Cordova WebView的localStorage在Android 7中无法访问?
这包括自动启动。这意味着当定义,在应用程序,蓝牙设备连接到,应用程序将启动。
这是做的方法:
- 保存在localStorage的(file__0.localstorage)bluetooths地址.// JS侧
- 广播接收器,在bluetooth.device.action.ACL_CONNECTED。检索的localStorage(file__0.localstorage):如果我们的localStorage开始连接的设备匹配设备app.//机端
这是在2016年年底编制和它的工作直到现在,即使有更新,软件明智的,设备。
我决定做一些应用程序更新,现在它停止工作。经过一些调试后,我看到我无法读取file__0.localstorage。这是我到目前为止:
File dataDir = new File(context.getFilesDir().getParent());
File appWebViewFilesDir = new File(dataDir, "app_webview/Local Storage/file__0.localstorage");
Log.d(TAG, "Absolute path is " + appWebViewFilesDir.getAbsolutePath());
//Result (rooted phone): path is given.
//Result (UNrooted phone): path is given.
Log.d(TAG, "Fine name is " + appWebViewFilesDir.getName());
//Result (rooted phone): name is given.
//Result (UNrooted phone): name is given.
Log.d(TAG, "Is file Readable " + appWebViewFilesDir.canRead());
//Result (rooted phone): true.
//Result (UNrooted phone): false.
Log.d(TAG, "Tring to set file to readable? " +appWebViewFilesDir.setReadable(true));
//Result (rooted phone): true.
//Result (UNrooted phone): false.
Log.d(TAG, "Tring to set file to readable for all users? " + appWebViewFilesDir.setReadable(true, true));
//Result (rooted phone): true.
//Result (UNrooted phone): false.
Log.d(TAG, "Is file Readable " + appWebViewFilesDir.canRead());
//Result (rooted phone): true.
//Result (UNrooted phone): false.
Log.d(TAG, "Does this file exist " + appWebViewFilesDir.exists());
//Result (rooted phone): true.
//Result (UNrooted phone): false.
任何想法何时有此变化?
任何想法如何使localStorage file__0.localstorage可访问,而无需root设备?
有可能解决这个问题,而不必实施一个新的数据存储系统?
P.S.数据持久性在这种情况下并不重要。