Reputation: 1060
I have build an Cordova App (cordova -v 7.0.1, cordova-android 6.1.0).
That includes autostart. Which means when DEFINED, in the app, Bluetooth devices are connected to, the app will start.
The way this was done:
This was compiled in the end of 2016. And it worked til now, even with newer, software wise, devices.
I decided to do some app updates, and now it stopped working. After some debugging I saw I can't read file__0.localstorage. This is what I have so far:
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.
Any ideas when has this changed?
Any ideas how can I make localStorage file__0.localstorage accessible without having to root the devices?
Is possible to solve this without having to implement a new data storage system?
P.S. Data Persistence is not that important in this case.
Upvotes: 1
Views: 1208
Reputation: 2940
It isn't really an Android 7 issue. The localstorage seems to depend on the webview. And the webview can be upgraded independently.
Is possible to solve this without having to implement a new data storage system?
Yes. file__1.localstorage was a SQLLite db. Now, in the same folder, app_webview/Local Storage
you should find another folder, leveldb
. LevelDB is a database created by google. You can use a java wrapper, leveldb-android for example, to access it. And then you should use the iterator to iterate over the entries, looking for the one you need. Calling get()
returned null
in my case.
Upvotes: 1