Database for data and pictures - android

I know, that I probably could try to learn everything about databases, but my way of learning is to get first push/hint from pro's and then try to figure out the rest. It narrows down the amount of things to learn at once. So far it works for me.
Long story short- my goal is to create Flutter app for iOS and Android, that can store pictures(preferably converted to PDFs- I'll do that later) and some user entered data about these pictures/PDFs.
Later the app needs to work with this entered data(sort, use, display, etc) and the app should store all of those images.
Ideally, if in future all of the data/pictures could be stored on cloud and accessed from multiple devices/app accounts.
What type of database could be most suitable for these purposes?
This is the first time for me to work with databases, so don't judge me too hard, please :) I just need a direction in which to dig.
P.S. my one goal is to build prototype-app and after it is proved that it can achieve its goals, hire pro developers to do the updates un polish everything.
Thanks in advance.

I would advise you to store your images in a directory structure decided by you. Then you can store the path to these files (along with any other data) in the database.

Related

Kotlin, app storage: Need to store an ArrayList of Integers from user interaction

I am building an app as part of a project and I am stuck at the moment.
Background: My team is making a "Time-Wasting" App, and the user can press buttons such as "study" to track their time spent on activities - so there will be lots of integers values in the growing ArrayList.
Task:
Store a growing Arraylist(integers) in the app store and retrieve the values for calculation and graph display purposes.
Problem:
I have looked so far how do to this, but I am a bit stuck. Do I use SharedPreferences, the internal app storage or something else. Also, I have a hard time finding code that I could look at and follow what it is doing.
I need:
An efficient way to store the ArrayList (integers) in a storage place and retrieve it for my app. Any suggestions what would be best and where would I find the code for that?
I looked for about 2 weeks through videos and a through stack overflow but I am still stuck and not closer to how I should store this data type in my app.
Thanks, any help much appreciated :)
My opinion avoid the array list and use a database.
It will allow your app to grow including storing extra information along with the time waster including when they chose to do it, how long , etc.
I recommend Room Database it is an ORM for Sqlite it is super easy to use and there is plenty of documentation on implementation as it's apart of the Android Jet Pack.
If you are really stuck on using a list you can use SharedPreferences it doesn't handle ordered lists but you can store your list as a json string.

Is there any way to send a database with information using an android app?

this is my first app and I am trying to help out a business that I work for. Basically I picked up Android Tablet Application for Dummies and have been using it as reference. I am making a sort of time card application for a business I work for. My goal is that I want to take the information that the workers would enter in over the course of the day, and have them email it to the person writing payroll. Is there any way for me to just email the database with all of the contents? Or a simple way to send the contents in another easy to read format? Open to all suggestions and alternatives, thank you for your time!
A raw db file probably is not going to be terribly useful for the payroll person.
If I were you I'd make something that will query your DB for all rows, once you have the resulting cursor you can iterate over it and put the data into some more useful data format.
The data format you choose depends on your situation. XML or CSV seem like good options. CSV perhaps a little bit better since it would be able to be opened in Excel (which anyone in payroll probably has access to)
You could also make your own data format if you want. Some sort of plain txt flatfile would be easiest, and it would be very human readable (Easier for payroll employee)
something like this:
IN Mike 2:31pm 6/14
IN Joe 2:45pm 6/14
OUT Mike 4:55pm 6/14
etc...
Then if you were nice you'd make something to go at the end that will tally up total hours for the day and/or pay period
Total Hours for period
Mike: 25.4
Joe: 22.3
etc...
EDIT: There are many examples of CSV all around the web.
Start Here to learn what it is.
Once you understand what it is you'll need to learn how to implement the read/write in java. You can do it with plain java using strings fairly easy. But there are also some Libraries out that that make it a whole lot easier for you to interact with CSV data.

I have some really huge string data to ship with my android app?

I have some really huge data that is required for my android app. I've put it into a sqlite db now. Roughly it is 39k rows and 5 columns. I want this data to be available for my app.
I'm kind of confused as to how I ship my app with it. i can ship the db file with it like discussed in this thread. or I can somehow create XML out of that data and ship it along. But the XML would be really huge. So what is the right way of doing it?
I do not want to download it after user installs the app. That'd be my last option if there are no better clean ways of doing it.
This should help you.
http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/
Basically just ship the database with your apk file.
I think shipping your DB could make some problems with compatibility.
Maybe it will be better to use GZIP'ed SQL code bundled to your .APK?
Or instead of XML for intermediate representation you can use google protobuf, which is most effective data representation format(Also, if you have a lot of strings, you can use it in combination with GZIP).
Check the example here to achieve this functionality.

Android: how to protect data in a SQLite database?

I'm currently developing an Android game which saves data into a SQLite database. This is not really "sensitive" data, but I don't want users to be able to modify it (for obvious reasons of game balance, as it would be cheating). And it's quite easy to access and modify a SQLite db when your phone is rooted (there are plenty of applications for that in the market).
So should I even worry about that, or consider users with a rooted phone can do whatever they want including cheating and that's their choice? Or could I somehow encrypt the data I don't want them to modify, or add a MD5 checksum or something similar?
Another approach would be to abandon SQLite altogether and use some kind of binary files with game data.
Please let me know if some of you already encountered similar issues, and what are the approaches you followed, as well as the "good practices" in the Android gaming development community.
Thanks.
Root access for everybody and security are mutually exclusive.
Any application or user with root permissions can read and modify each and every file on your system, as well as all of the main memory. That doesn't leave many places to store a potential encryption key for the database.
You could hide parts of the key in the executables, configuration files etc, but everything you could come up with would be nothing more than obfuscation and security by obscurity.
If a user opts to grant root access to everybody, that's their decision, and it's not your job as an app developer to prevent any harm that might be caused.
Update:
Storing API keys in Android, is obfustication enough? is a pretty similar issue - it's about protecting API keys, but it's the same situation with regards to your options.
sqlcipher for Android might help here.
https://guardianproject.info/code/sqlcipher/
I think based on your requirement the best method is using consistency of data,
for example MD5 the score and time, then put score and time and MD5 in to the table, then every time wanting to use that row of DB check the MD5 of the score and time if the one in DB and the one which calculated are same, the row is consistent otherwise it was hacked!
You may find your happiness on Preferences Files Look here

SQLiteDatabase vs File storage

I want to store structure type data (i.e. information of call logs like name, number, type of number, date, time, duration). Which is the best way and which is faster? SQLiteDatabase (make table and insert, delete logs in it) or use file storage (means make one class for all parameters and write their objects in file using input/output Stream and serializable) or the another way i heard about it is XML parser but i don't know this.
Please help me. Thanks in advance.
It depends on what you are trying to do.
If your goal is speed, the SQLite will give you a serious run for your money (especially if you wrap multiple inserts into transactions). SQLite has been optimized for everything you mentioned and it would be very easy to leverage the speed it can give you.
If portability is your goal, then files may be a slight bit easier. Files can be moved back and forth very easily easily, whereas SQLite might take some more effort.
If being able to search is your goal, then you'd be a fool not to use SQLite, as it is extremely good at searching and filtering results.
I can't give a very informed answer here because I'm just as new to the subject as you are, but here is the link from the developers page that goes over the different types of data storage. I hope you find it useful. http://developer.android.com/guide/topics/data/data-storage.html
Personally, given you know the basics of Databases I would use a sqlite database. It's pretty straight forward in Android. In terms of speed I don't know which is faster, but if you don't have millions of datasets it won't matter.
In my experience in most cases JSON in a file is enough (mostly you need to store an array or an object or just a single number or string). I rarely need SQLite (which needs more time for setting it up and using it).

Categories

Resources