I'd like to receive some advice from all of you.
What is the best way for me to alert users on an update to my app? My app is a very knowledge-based & it works like a dictionary, so there will always be updates to it.
The database I have used is by DB Browser for SQLite, and they are all local database where it is uploaded into the assets folder in Android Studio.
Currently, the limitations are that:
1) it's obviously not real-time because it's stored locally;
2) every update I make to the database structure, I am required to upload the new database into the assets folder again, followed by uninstalling the old app on my phone, then run the app to install in my phone again so that the new database is overwritten.
I have read (How can I regularly update a database of content on an Android app?) & some others, and it seemed like I have to have a server, a cloud-based database & live app in market, to solve the limitations?
Is there really no way for me to overcome the limitations if I want to stick to a local database? At the same time, I kinda wish to avoid setting up a server because I am not intending to make the app live on market, and also this is just a school project I am working on and as such, I have very limited skill sets & knowledge about it and would like to make it on a school-project-based level.
Thanks in advance.
One way to do it is to connect to your local DB through local network instead of assets folder. Therefore, you can update the information by querying the local DB.
As for syncing the information between DB and your application, you should create a trigger or watcher that notify your application when the DB is updated. Therefore, your application can know when to query the DB for the updates. Another way is to just query the database periodically.
Bonus: you could move your database to a cloud-based database. Usually there are several providers that provide free database hosting up to a certain size, which should be enough for your project.
Related
New to Android app building. I built our company website using php/mysql and my boss had an android app built previously with, I assume SQLlite, or something. Anyway, he wants me to change the database that it's currently linked with to our mysql db. For the life of me I cannot find anything even resembling a connection string or a query in the file system? In my attached screenshot where would I find this information? Or is it not held in this tree at all?
I would assume the data/model folders, but I've searched every single file in those folders. I really need some help.
SQLite is a local db. There would be no connection string, its literally accessed as part of your process.
You should NOT directly connect to a remote db. Doing so is completely insecure, as it would be putting the password for your db into the app. You need to run a web service, and hit that to get your data. The web service then connects to the db.
You should also probably figure out what the actual project is. With SQLite, you would work offline, based off a copy of the data stored locally. With a remote db, offline use is impossible. Being told to replace SQLite with a remote db and your level of understanding of that in this question shows that one or both of you don't understand what the scope of that change is, and you should make sure you're on the same page and what the best way to achieve the actual goal of your project is.
I have started working with databases lately, I was able to create a local database and manage it in my Android app. Now I want to move to higher level with it but I don't know how to do it.
The users in my app need to be able to modify the database, for example insert new data in it. When a user insert new data in the database I want other users to see this change in their copy of the database.
I understand that I will need to store that database on a server or something and synchronize it with the users.
Can anyone tell me the steps to do so?
You should perfom this task in steps.
First, make the local database, and use a system to know when/what changed.
I usually work with triggers myself, but any "mark" is enough to synchronize.
Then, you must make a replica of that database somewhere else. Realise that maintaining the databases is a process, any change in the structure of one database must be performed in all other as well.
Finally, you must implement a method to transfer the data.
So, for an example:
db_local the database in the device.
db_outside the database in the internet.
db_local.trigger -> onInsert
On the applications, check for internet, then connect to your server, then upload the same command to db_outside and run it...
In this step, you must handle connection issues, and if the SQL command was succesfully executed, you have replicated the database content.
Once you have the replicated database, inform a system (like google cloud messaging), that the database was changed, and have the other users pull the info.
Still newish to Android.
I need some advise, Should I
1. have a local sqlite DB, and have the app check for new records uptop in a mysql DB
OR
2. Publish my app with a full sqlite DB. When ever I insert new records to the full sql lite DB then publish updates?
I've been scouring the internet for some guidance. Since I am still newer to Android I wonder the difficulty in making #1 work (since I'll have to gen the php code as well).
My suggestion is:
If it's only 200 records now, it doesn't really matter if you preload it or get it from a web service (getting the data will be very quick). Usually preloaded database is better when there is a lot of data and you don't want the user to wait to long before using your App.
On the other hand if there is a lot of data, it will increase the apk size.
Create a web service method for updating the data from the server.
Create a web service method which indicate the client to delete some rows (I dont know what your application does, but usually it's needed)
What do you mean by 'uptop'? Assuming you mean 'online via an API'.
depending on the nature of your data (is is mission critical? what's the risks if it is stale? etc), it's good practice to pack static data with the app that can be referenced by the app much sooner than the updated data...the updated data is a task you run to update that stale data, and perhaps continue to run periodically to keep it updated.
It's bad practice to pack a SQLite db itself in an app, as some manufacturers do their own thing with the implementation of SQLite itself. So pack the SQL as text and create a fresh DB on the device with that.
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.
I there a way I can set up my app so that things like the database and images can be optionally downloaded/updated when when I make changes to the data, without updating the app. i.e. a kind of syncing with the new data?
I would have the database and images on my server and the user can update or not without having an icon on their phone saying there are updates available.
As far as I know, Android databases are just sqlite.db files. You should be able to have a button in your app that downloads a new sqlite.db file from your server. Have it replace the file that is already on the device and you should be good to go!
If you have a localized database you can modify, add to, and delete as needed based on server response. Create a robust enough Database Helper and you can use it to make the database whatever is needed, in a run time environment.