What kind of database/storage does google keep chrome app use? - android

Am looking to build an app that would function like google keep.
just a light brush of the features:
Chrome app with offline storage - save online when internet is available
Android app and ios that would sync with the web server and also update locally and online
-single user
Am thinking that I would have a bridge(SERVER) of some sort to handle the imports and exports of data between different platforms. Thus emulate a sync.

Keep uses IndexedDB as it is the standard datastore available to Chrome Apps. You should be able to right-click on the screen and see the code (visit the Resources tab).
Chrome Apps also has Synchronised Storage that will manage offline and cloud access to your data storage. This means you can set a key on one machine the user has and see it updated immediately on the other machine of the user. The problem is that if you as a developer want to access and manage this data you can't do it, which is why Keep chose to use IndexedDB and manage the synchronisation themselves.

Ay used Index DB but it saves the content somewhere as indexdb only saves to the local computer. SO needs to be saved somewhere else.

Related

How to save .csv in public location on Android 11 phone?

I have a simple one activity app that creates a CSV file, appending rows from edittexts using one button. The intention is to gather data on this phone app and then process the CSV elsewhere.
I have developed the app in android studio using context.getExternalFilesDir(). It works great except the CSV is not available in a public location once moved onto a phone. I need to CSV to be available via a Files browsing app and email app on the phone. Ideally I would like to put it in the documents folder (either on phone or card) but any pucblic directory will do!
I read it is recommended to use the Storage Access Framework but I understand this will demand user interactions. This is a simple convenience app that will be constantly used for 6 months, so requiring regular user interactions to browse to locations and grant permissions is not acceptable.
Or can I use SAF without involving user interaction? Alternatively, I suspect I may be able to target an older SDK but have no idea if that is correct and how would that work on the phone running Android 11? Or can I use the Media API to save a locally made text/csv file? Wow, it's a minefield. Any help much appreciated.
This app will never be available on play store. It will only ever be installed on one phone. My app use Kotlin so a Kotlin example would be the best!
My question: how can I save the csv in a public location on an android 11 phone without requiring constant user interaction?

Share greasemonkey script and database between Windows and Android Firefox

I've been using a homemade greasemonkey scripts for ages on my laptop Firefox. It includes storing data with GM.setValue.
Now I just bought an Android tablet, and would like to be able to use this script and update the values, whereas I'm using the laptop or the tablet.
Hoped that Firefox Sync would handle that, but not even the scripts are synced.
I thought of synchronizing the script dans db files (Google drive, dropbox, whatever), but I realized that since the v4, the db that used to be in gm_scripts is gone, and I have no idea where Greasemonkey stores either the scripts or their associated database now.
I'm looking for anything that might make it work.
1) Is there a way to handle that with Firefox Sync ?
2) Would an alternative (Tampermonkey, Violentmonkey, ?) handle that better ?
3) Where can I find the scripts/database in the new Greasemonkey system ?
4) Could I synchronize them via Google drive ? (There seem to be some hacks to sync a file between machines)
5) Would there be a simple, free alternative that would allow me to synchronize a very small file between machines ?
===============================================
Update on this:
I tried TamperMonkey instead, it has a sync feature but even if it seems ok on different laptops or my phone, the syncing is random at best on the tablet.
Also realized that only scripts are synced, and not their data. The script almost never changes, but the data is updated several times a day, so not really a solution anyway.
Data doesn't exist anymore in a readable file format, so no luck either on syncing the data file externally.
TamperMonkey has also an import/export feature, this does take the data into account. So the best I can do for now is thinking about exporting then importing every time I switch device. Not ideal so still in search of a better solution.
Conclusion:
1-2) I switched to TamperMonkey where I could easily up/download scripts from Google Drive (or other).
3-4-5) New browser extensions architecture means that you basically can't access the data on file system
The only solution is to store/retrieve data elsewhere, not with the GM methods. I stored mine in an airtable base, because it offers a pretty easy to use API that can be called from user scripts.
storage.sync
Represents the sync storage area. Items in sync storage are synced by
the browser, and are available across all instances of that browser
that the user is logged into (e.g. via Firefox sync, or a Google
account), across different devices.
There are limitations with sync.
Sync requires login
Up to 100kb can be synced and more than that fails
Storage sync usually syncs the entire extension storage and in case of user-script managers, they are often larger than 100kb as they include the user-scripts as well
Data is stored elsewhere (not on your computer) which can have security/privacy concerns
Storage read/write requires internet access and longer times due to remote data storage
Extension must have the sync option
1) Is there a way to handle that with Firefox Sync ?
Yes but depends on aforementioned. While Firefox sync doesn't appear to have the 100kb limit, syncing the entire Firefox takes longer (How do I set up Sync on my computer?).
2) Would an alternative (Tampermonkey, Violentmonkey, ?) handle that better ?
Greasemonkey: No sync feature
Tampermonkey: Sync to Dropbox, Google Drive, or a WebDAV service
Violentmonkey: Sync to Dropbox, OneDrive, Google Drive, or a WebDAV service
Firemonkey: No sync feature
TM/VM 3rd party storage sync allows storage of more than 100KB. However, using 3rd party storage allows 3rd party tracking which is a privacy consideration. The storage read/write operation is also a lot slower.
3) Where can I find the scripts/database in the new Greasemonkey system ?
Since Firefox 57, extensions can not save files to the HD and the only storage area is the extension storage which is not accessible as before.
4) Could I synchronize them via Google drive ? (There seem to be some hacks to sync a file between machines)
Refer to above
5) Would there be a simple, free alternative that would allow me to synchronize a very small file between machines ?
That depends on the set-up and how often data is changed.
For example, if data is not often changed, especially if the data privacy is imperative, there is the backup export/import option (script + data). Therefore, the extension data can be saved to a USB flash drive and loaded anywhere (suitable for shared environment).

Share data between users on multi-user Android (4.2 or later)

Android introduced the Multiple Users feature in 4.2 (Jelly Bean MR1) and its documentation states:
From your app’s point of view, each user is running on a completely separate device.
And here is a quote from the Environment.getExternalsStorageDirectory() and getExternalStoragePublicDirectory() methods doc:
On devices with multiple users (as described by UserManager), each user has their own isolated external storage. Applications only have access to the external storage for the user they're running as.
Could it be true that there really is no reliable way to communicate data between users on a single device without using the network as mediator? I'm looking for solutions that don't rely on quirks of how the device's file system is laid out by a manufacturer. Also, for security, the sharing should be internal to my app.
Even if file sharing is indeed impossible, is communication via intents somehow possible?
There are use cases for this. Use Case 1: let's say I'm writing an input method app that requires a 100MB dictionary file. I'd like to code things so that if User A downloads this file, then User B can access it also without needing to re-download. Use Case 2: let's say I'm writing a fun Leave My Wife a Note app that allows User A to type messages that will appear next time User B logs in (without using the network).
This thread on a separate site proposes a solution, but their method seems undocumented and possibly unreliable. And there are a few other SO questions that have a title similar to this one but are actually discussing different topics.
OBB Folder (/sdcard/Android/obb) is used to share files and folder between the multi users. But OBB folder not shown in my second user (One plus 5 mobile). So I have tried to create an OBB folder in Android folder (/sdcard/Android/) in second user and "BOOM" it worked. Now i am able to access the shared files in second user. Try this trick if OBB folder not shown in your second user.
OBB files (stored in /sdcard/Android/obb) and used as expansion files in Google Play are shared between all users by design, as they are fairly large. If you Input method uses expansion files, the downloaded data will be shared automatically. You can send broadcasts to other users but that requires the INTERACT_ACROSS_USERS permission, which is reserved for system applications.
I also had the same question, and have tried various approaches such as using /sdcard/Android/obb but it does not work in Android 10. So I followed below approach, and I am able to copy files seamlessly between users.
Login to the User from where you would like to copy files from (lets call U1)
Run FTP Server using any application of choice like MiXplorer / ES Explorer etc... Note down the details of the port#, username, password etc... and point it to /sdcard
Switch user, to where you want to copy files to (lets call U2)
Install the FTP browser. If you use MiXplorer / ES Explorer, they will allow you to add a FTP share
Use ftp://localhost:2121 assuming the port is 2121, if not change it accordingly and add the FTP share
Open the FTP share and you can see all the files & folders of U1 here
Copy across to your heart's content !

HTML 5 local storage between app and browser

Is it possible to access the same local storage from a mobile app (ios/android) and a website? For eg, test.com stores value A in local storage and then would the mobile app be able to access this value?
HTML5 local storage API does not dictate the internal storage format. Therefore it will lead to ad-hoc code to use the internal storage format. Portability across browsers can be a problem because of lack of internal format specification. If your mobile app (native app) writes something to the local storage you should ensure the format is 100% compliant with the browser's internal storage format because you don't want the browser to be confused with the data when the browser has to read it. There can be surprises when both the browser app and the mobile app are running because both of them can update the data. Who wins if there are conflicting updates? How do you ensure data writes do not end up in garbled file in case both browser and mobile app happen to write data at the same time? How do you protect against such race conditions? At least HTML5 has no locking mechanism! Looking at all this complexity I believe it is not worth the complexity and the pain!!
I don't think your standalone web app will have access to the same data that you stored from the browser.
At least in the case of standalone app this data is stored in an sqlite3 db that is inside that applications internal storage folder so something like /data/data/com.your.package/databases/webdata.db I forget the precise name, but it's in a db there somewhere.
The browser I would assume does something similar but stores it inside of it's own storage area /data/data/com.android.browser/databases/. I don't think the browser or stand alone apps would take the time to go through all of the db's for every possible application on the phone to find the data. (if it even could, I think those files are actually private to the specific application on a stock device)
EDIT: The results are in.
No your app cannot access the key/value pairs that were stored from the stock browser (or any other browser for that matter). Nor vice versa, no other browser can access the data that your stand alone app stored.

Sample data stored locally with a PhoneGap based app on Android

We had initially planned on developing a native app for Android but PhoneGap is looking like a better option.
One thing we need to have is when the user installs the app, they need to have local access to a sample of the data in our back end database but have it stored locally. On the native app we had planned that when the user installed the app, the installation process would also trigger a retrieval of a chunk of the data in the back end database so that they could make basic usage of the app without relying on an internet connection all the time.
This data will include JPG files and perhaps some audio files. Will HTML5's local storage address this requirement?
short answer: YES
That's what makes phonegap awesome, you may create a database in to store the persisting data details (name & path)
When you run your application, you will test the connection, if there is no connection you can refer to the local files through your database else if there is connection you may download the new data, save them to the local database and then delete them from the local storage (Sdcard & database).
to find more check the phonegap's file docs
Just to add to what T.Baba has said, yes it is very possible, and I have recently built a webapp with PhoneGap and jQuery Mobile that does just that.
I used localStorage to contain all the data, and in particular localstoragedb. I haven't stored any images and/or audio files in localStorage and wouldn't recommend it anyway as most devices will limit the space to 5MB, but PhoneGap does give you access to APIs which will allow you to save files on the user's device. You can also of course bundle the files with the app and access them accordingly.
Indeed it is. Phonegap is best option for that.

Categories

Resources