I have problems.
I create an application which is on starting it will synchronize the database in external storage with database on website if any data changed it will appear dialog to ask "Do u want update".
I put my database on website http://example.com/folder/mydb.db
and for android I put it on external at data/data/database/mydb
How to check any database changed?
Change the name of the file you upload, adding the version number so you can just compare the file name to check for modification.
If different, download and override your existing DB using the tutorial here:
http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/
Related
I wrote an app that saves and uses data in/from a Cloud Firestore database. I would want to organize more clearly than for the moment my files, for example by using DOs and DAOs.
I know the concept of "DAO" exists in Android Room.
However, the documentation seems to define Android Room as a "local database". So if I understand it well, I shouldn't use it in addition to Firestore?
By the way, it would be the same with Firebase Cloud Realtime Database (a third database system).
Edit :
I didn't understand the notion of "local" database (Room). Tamir, in his answer, corrected me. This question is off-topic.
So if I understand it well, I shouldn't use it in addition to Firestore?
No and this is beacause Cloud Firestore has offline persistence enabled by default:
For Android and iOS, offline persistence is enabled by default. To disable persistence, set the PersistenceEnabled option to false.
This means that you'll have by default a local copy of your database. So there is no need to add another one.
Basically, when you are developing an app there would be some data that you will want to save into locally and other data that you will want to save on remote database, it's not a bad thing to have both remote and local database.
Some example that I can think of for saving your data remotely is to manage users - when a new user will be created you will want to check if the username is not taken, and you can't do it if this data is only stored locally.
And for using a local database - one of the major advantages in the local database vs remote database its the speed of writing and receiving data.
Here is a nice article on the subject.
So I got a simple app with a sqli database,
the app just shows the content which is saved in the database.
So if I am correct the sqli database is saved inside the app (apk),
what I am questioning myself is if I do have repeatedly upload the app / apk if I change, delete or add something in the database.
If yes is there a way around this, to like get the data from a database without repeatedly uploading the application if data has changed.
Yes, if you change something in the database you need to upload the apk, because the database is inside the apk. The alternative would be to put the database on a server. Then you would write a back end for your app in your language of choice, and this code would access the database. You could also use a Back End As a Service. Google BAAS to get info on the available options.
I want to store some data like name and class of different students in form of SQLite database.
I want to develop an application which uses this data not fill it. I mean application should not fill it.
My application will use this data to make a report. This database should be bundled with my android app
So how to create this database on android?
How to bundle this database with the app on android?
I mean my file should be an apk but when installed it should have this database also
Please kindly give your advice
Yours Sincerely,
ChinniKrishna Kothapalli.
Basically, you need to do that :
1) Create a file containing your SQLite database into your assets folder
2) When you want to access your database, check if /data/data/yourpackage/databases/yourdatabase.db exists
3) If it doesn't exist, copy it from your assets to /data/data/yourpackage/databases/yourdatabase.db
4) Call SQLiteDatabase.openDatabase (it takes a path in parameters)
I would like to write an application for iPhone/iPad which will use a database. This database is populated by a third party server so I would like to know what is the best method (SQLite,...) if I just want to drag/drop the database into my app. The database might be big so I don't think XML would be good.
What do you think?
Enable iTunes File Sharing for your app by adding UIFileSharingEnabled to it's Info.plist and setting it to YES.
Then write your app with a mock DB in place. Put the mock DB into the documents folder.
Every time you want to update your DB, simply connect your iPhone to your Mac, open iTunes, got to file sharing and drag-drop the new DB into the sharing window. This will overwrite the old DB without you needing to rebuild or reinstall.
I recently made a change to one of my app engine models. I changed a Key field to a String. I forgot to remove all the old records. I have already added new records that have strings in the key fields. If I do a query for all the records I get an error, can not cast Key to String. If I try and change the class back to the old way I get can not cast String to Key. All this info is on the local file. How can I delete this data and start fresh?
When you say "local file" you mean in local development server? If yes,
then the local development GAE server also comes with a Admin console which you can use to view and edit the data store. Its located at http://localhost:8080/_ah/admin (check port number)
alternately you can restart your GAE and the local data would be wiped off
If no,
You have an admin console un app engine (view it in your app's dashboard). You can execute queries to modify data store from there
worst case, you can write a small servlet that will execute "delete" queries for the data that you dont want and execute that servlet
I'm assuming that your interest is NOT is supporting both the use cases - hence not thinking about that here.