Hybrid mobile app local storage - android

I am making an offline game app using Phonegap. I used to store everything online for my previous web app projects, but this time I want to try local storage.
I see there are couple of options for Phonegap:
- WebSQL, it seems just a SQL database.
- IndexDB, which is not fully supported by Phonegap
- File system. I mean I can cache the data on the device's local file system in my own pattern like most of the PC games do.
Suppose it is a RPG game and I need to store maps, characters, characters' items, characters' relative position in their map, etc...So I may often need to joint 4~5 tables in a relational database and deal with thousands of records. Is it going to be a heavy burden for WebSQL? If I use WebSQL, how will it be stored on the device's file system? If WebSQL, how can I let the app load the initial settings of the game when the app is running its first time?
I am also wondering how to load these data during the runtime of the app. Do I cache everything into the memory when the app is initialized, or only retrieve the piece of data I need when I need to use it?

Related

What is best way to store large data in local for iOS/Android

I'm working on an app and I have tried to use local storage but I'm not sure if it will be OK for my project.
I need to store really large data every second in my local database, and at the end of the day send to my server. This can be large data because every second write my GPS coordinates.
What is best: SQLite, local storage or websql?
I work using cordova.
I appreciate for your help.
Regards
I am an Android developer so this is how it works in Android :
Shared Preferences - simple key/value pairs specific to your application. This is probably the closest to WebStorage - only for small amount of data.
Internal Storage - read/write files(only the app can access it)
External Storage - SD card file storage(app + other apps including the user) can access it).
Databases (SQLite) - better for large amounts of structured data
Network - obviously, you can store/retrieve data remotely if needed (like Firebase).
What would I choose? if data is structured then I would choose SQLite.
More detailed information :
https://developer.android.com/training/data-storage
cordova-sqlite-storage is Native SQLite component with API based.
It will easily handle large data and easy for CRUD operation.
Yes you can use cordova-sqlite-storage for large data inputs. But I think it is also advisable not to stress your device with so much data in it because mobile is just mobile with so many limitations in terms of hardware. Maybe you can just set a treshold of data size and after reaching it, send it to your server then clear your database.
The point is don't stress you device, use minimum data as much as possible to provide a clean app for the users.

How to store the large volume of steaming data in sqllite for a mobile app

I am building a mobile appfor Reporting and Business Intelligence. The app will show a live stream of billing, payments and other data to management of a company which is doing business across 70 different physical locations. The idea is to see what is happening in the business across all locations as a live stream on line graphs on your tablet.
However the question I have in mind is that with billing and payments data across 70 locations, this stream of data will be huge, and continuous. Over 1 year this dataset will exceed 10GB. Should so much of information be kept in a sqllite database on a mobile? Are there any best practises on handling such large datasets on a mobile app? Tx.
For large databases you should use Realm. It is noSql db and it is more efficient with large data sets. But, more importantly, you can store realm database as ordinary file on SD card.
As I understood from your description, you need to store very large volume of data, but you don't have to access any portion of it (access latest data immediately and previous data with some delay).
You can create system's architecture in that way, so there will be 'database adapter' for Realm, which will take one file, extract data from it, convert it to anther format (in background, of coarse) and then upload those data to AWS or any other cloud storage.
If you use Realm, you can just monitor file size (database is ordinary file), and, if it exceeds given value, create new database file and process previous file in the way I mentioned.
Another approach - interpolate your data and save interpolation factors, but there is math envolved and some data will be lost.
Yeh, all data is kept on remote server, and you uploading some pieces when you need it. Don't know if it's what you searching from.

how can I call Items from database in unity3d?

I'm trying to develop a mobile application which uses Unity3d and Vuforia to create an AR app.
Is there a way to create a database in unity and by scanning an object, it will display windows with the content retrieved from the database?
For example, I have images and descriptions of food in price groups
and if I scan a bill, it will pop windows of the images in the database which belongs to the price group.
If you wish to keep the app offline you'll have all your data stored locally on the device and can only update the data by updating the app.
If this is the way you want to go, the task is more or less straight forward. You can either:
Keep all the data in files and load them from your Resources folder at runtime (Resources.Load) or
Deliver a database engine with your app and use it to access a local database also delivered with your app
Depending on the complexity of your queries the second approach might (!) be more practical, however, database engines can be problematic because they may not be supported on all the platforms you may want to target.

Profile images save as blob vs in filesystem

So I've got a unique system going on which is spread across 2 apps and 1 website. All 3 components of the system will share the same data source now each user has 1 and only 1 image to upload which will be their profile image. I'm debating if I should store them in the file system or the database the trade here are equal in my eyes. Storing them in the file system I'll have to retrieve them in 3 different systems from one server hassle.. on the other hand storing them in the DB could potentially make the DB slow.
One thing I see happening here is what if I make an images table and not back it up and just have all images reference an image in the images table. Worst thing that can happen is I'll lose all images.. xD which isn't really significant
I'm using windows azure to host my database
my website will run asp.net on windows azure and I'm using azure mobile services to serve apps
Since the same image is used by 3 applications, I would recommend using a central place for storing the image instead of storing it locally in the application. The advantage you will get is that if a user updates the image from any application, changes will be reflected in other applications as well without worrying about the synchronization hassles.
However instead of using a database table for storing images, use Windows Azure Blob Storage. It is meant for that purpose only. Furthermore your data is replicated 3 times within same data center and optionally you could geo-replicate the data for additional redundancy. With blob storage you don't have to worry about backups as well.

How to build a simple offline form submission app?

I'm a Webdev beginner, have been learning some Python/PHP/Javascript and want to help a friend of mine with a project.
She's conducting a large scale survey of old houses/windows, and fills in forms (similar to Google Forms). However, she doesnt always have 3G coverage on her phone, so she wants some way of uploading the data when she gets online, and she wants to be able to upload photos and attach these to the forms.
I've found a javascript-library which makes use of html5 localstorage, but I havent understood if localstorage also accepts file uploads? Also, when you have submitted one form you would need internet access to open up the form again to submit another form.
Are there libraries or projects around that would help me with some of this, so I dont have to reinvent the wheel?
This is going to be very difficult to do with a web app. Your going to have to rely on something like AJAX to send the data and if it times out store in local storage and keep retrying every few minutes, because a web app has no access to anything like checking the wifi status etc.
Also that there is a limit to the size you can use in html5 local storage:
What is the max size of localStorage values?
, this is not going to work if you want to hold onto photos.
This would require a native or minimum a hybrid app (like phonegap) to store the data on the actual device in a file or SQLite database. This way you can store what you like, have access to the status of the internet connection and even have prompts to appear on the screen (when the app is in the background) to remind her that there are still some that need to be uploaded.
It will be much more reliable and stable this way
You can create an app which stores the data (form) in the Local DB (ie SQLite) of the App.
Once she is online (mostly wifi) she can start uploading the data.

Categories

Resources