Android Database SQLite or MySQL? - android

I am new to Android Development and I'm developing an application for my Final Year Project.
I am a little confused as to when it comes to setting up the database. I read a few things and most people seem to use SQLite.
Basically I am developing an android app which has too different aspects to it.
1. admin inputs data on the app and saves to a database. 2. users open app and view data from the database.
The data is going to have to be input and viewable over the 3g/wifi network.
Do i need to host my database online and which database would be best to use? from reading it seems SQLite is hosted on your local disk so should i use MySQL?
Any help would be grately appreciated.
Thanks

Android includes SQLite. So, if you save data in a DB on an Android system itself, you use SQLite. If you store your data elsewhere, you are free to use whatever you like, Oracle, DB2, Mysql or even SQLite.

Related

Regarding Database on Android

Is it possible to store data directly to the database without having the user input something in it. I am planning on creating a school updater which updates students regarding school news and such. What confuses me is that how can I store data directly into it. Im not that good on servers so Im resorting into databases but Im confused where to start.
Thanks a lot!
Do you want to store data in a remote database? If yes, you may want to use REST-APIs/Webservices and process the data on the remoteserver.
You should not (except Databases like CouchDB) connect your device directly to any remote remote device for security reasons.
Anyway, you may create a local SQLite database on your device and synchronise the data using REST.

How to make changes to sqlite database for app that is installed in multiple devices?

I started developing an app that uses sqlite that is to be installed on multiple devices and any updates done on sqlite database from any device are to be reflected in other devices as well. I have researched a little and found that Sqlite DB is local to a device and changes done in one device are not reflected in others and for that I have to use external server. Is there any way around it?
Is it optimal to directly store data in external server or use sqlite and sync it regularly with external database?
Thanks in advance
As far as I know, there isn't a way without an external database. I would recommend you to sync it regularly with an external database.
Checkout this question for more information how to do that:
How to sync SQLite database on Android phone with MySQL database on server?
Answer of Andrew White
Create a webservice (REST is probably best) and serialize your SQLite/MySQL data and PUT/POST/GET it to/from your web service. This will give you a nice layer of abstraction in case you decide to switch from MySQL to something else server side.
You will achieve your goal using external server. It's not necessary to create your own server, just use data store services like Parse. For more look here.
You can use data directly from external server or cache them on your device first (sqlite, prefs, json etc.) – it's up to you.

One to one synchronization of SQLite db between app and server

In my app I have a SQLite DB want to backup to server but what I want is one to one synchronization for off-line backup (e.g. standalone SQLite file instead of a centralized MySQL server, mainly performance reason and I don't need real time query)
Ideally I don't want to upload the database everytime when I need to sync, prefer only sync the changes?
Are there any existing solution for this? (I can consider using other file DB as currently I mainly use SQLite as Key-Value database)
Thanks.
As you are willing to consider using a different DB, take a look at TouchDB-Android. This syncs a database on an Android device to a CouchDB server. There is a related project SyncPoint, that automates setting up a database for each user.
We are using TouchDb-iOS for our product at the moment are planning work on an Android version using TouchDB-Android soon.
The development community is active. Check out the user group.

Database communication related to Android Development

I have a simple question for you, What if I want to develop an Android Application which uses a database for storing the data and retrieving those data, I know that there is an option to use SQLite, as I know SQLite is something which stores the data in a device , or you can say within a system somewhere, what about if I wanna store some data from one device and retrieve those data from another device?? I mean what is the best way of having a single Database which will communicate with all the devices? to be clear, using SQLite it seems to me like more as a local database not a global.
Thank you!
Lulzim

Android - reading/writing to online mysql database

I've just written a short Android app which stores userdata in the phone-side sqlite database.
What I'd like to be able to do is to add this to an online database (I currently have a mysql database with my webhosts, but if there's any easier way then I'm open to suggestions), but it'll be subject to condition (Such as if a certain value doesn't already exist). I'd also like to be able to get data from this online database too to be added to the sqlite database on the phone.
I've had a look around and people seem to suggest using php as a go-between for that, but is that the easiest way? there aren't any mysql helper classes that could just interface directly or anything?
Newbie question I know, but the project was to teach myself how Android works so getting stuck in is the way to go..
Cheers!
Yes; using PHP is an example of an easier way to go. You need to create web services which allow you to interact between the android phone and a MySQL database. To my knowledge you can't go directly to a database hook; as you need to have something that can hook in. Also it would be a security issue if you put on each and all of your phones the connection information for your database.
Think if you had to change the host of your DB as your traffic grew large that you needed to upgrade; this would be a new update in the store and all clients would need to update this; otherwise you would be maintaining two code bases.
By using PHP you are able to create that middle level and easily interact with the DB.
Here is a quick article on creating REST PHP Web Service. Tutorial
Good Luck!

Categories

Resources