I'm using sugar orm in my android application and its already in Google Play Store.
Now I want to update my database schema and send an updated apk to Google Play store
However there is a problem while I'm trying to update my schema with following the official documentation of sugar orm.
(Adding version sql files with neccesary alter commands like alter table ....)
For figuring out the problem, I'm looking for the actual sqlite database file in the device, but I am not able to find it in anywhere.
I'm using genymotion emulator as samsung galaxy s6 device , so do you think is it something related with that? Or do you think are there any other problem
Does anyone know how can I find the actual sqlite database file path for sugar orm
Thanks
Found the solution here
https://gist.github.com/sibeliusseraphini/b060c415604c52c2a94e
So I could pull the db file and then figure out the problem
"Column names must be upper Case"
Related
I am using Sugar ORM in my Android application. I have managed to save/read data to/from the database successfully. Now I am in the need to get the created database and check some info for debugging etc. I might also need to use a prepopulated db the first time.
How can this be done in Sugar ORM? I can't find anything in the documentation.
If it cannot be done, Please propose any other easy-to-use ORM that has this ability. (Don't tell me OrmLite, it is not easy to use such as sugar orm)
I see you ask this quite a while ago but I am just finding it.
You can connect adb (Android Debug Bridge) to your device and open an adb shell.
Then in this shell navigate the shell to the database directory and use the SQLite3 command to access the database.
It works quite well in Android studio with the emulator. I have not tried it with other environments yet.
You can't do it using Sugar ORM right now. There is already an issue to pre-populate data using the migration script, see https://github.com/satyan/sugar/issues/87.
Another quite similar ORM to use would be DBFlow which is also very easy to use.(https://github.com/Raizlabs/DBFlow). I just made a POC using a prepackaged database which worked fine. See https://github.com/Raizlabs/DBFlow/blob/master/usage/DBStructure.md for more details how to do that.
Edit: Also check out ActiveAndroid which seems to be very similar to Sugar ORM and also supports pre-populated databases (https://github.com/pardom/ActiveAndroid).
I'm working on an app that uses sqlite to store data and I need/would like to view the tables in the app to be sure things are being added correctly and the content exists. How do I review the tables and their data being used in my app.
I'm using a Nexus 7 with 4.4 on it for testing the app.
You have basically two choices.
Run the app in the emulator, then "pull" the db to your dev machine and use a tool such as SQLite Expert Personal 3 to view the db.
Create your db in the external storage instead of internal. Then you can use your USB connection to "pull" the db.
I guess I can add (3): add code to dump your tables to the log file.
I don't know this can solve your problem or not but installing THIS plugin into eclipse help me a lot to view database table and content inserted.
Is there a way to connect to the SQLite database while the emulator is running and do manual queries against the database?
The following is a basic sequence of steps I'm looking to achieve:
Query user table.
Add a user via the program.
Query user table to verify add successful.
Yes there is, and there's even a guide on the Android developer site.
From an adb remote shell, you can use the sqlite3 command-line program
to manage SQLite databases created by Android applications.
Note that you can also copy the database file out of the emulator using DDMS, and then examine it with tools like SQLiteStudio.
This is an old question but if anyone still looking for this then Facebook Stetho is the best tool for debugging DB related stuff:
http://facebook.github.io/stetho/
Only downside is that you need to add a couple of line to your gradle script and application class. But well worth it.
I followed instructions on http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/ and succesfully inserted sqlite database on android device so user doesnt have to download data to start doing somethnig. Problem is I don't know if this trick will work on all Android devices. Does anybody have any bad experience relating to version of device, version of database or something to think again about this method? Would it be a problem if user moved app on SC card?
I have used a preloaded SQLite database in my Android applications without any problems.
I don't see any reason why doing this would be incompatible with certain devices as long as your SQLite database is compatible with the version that Android ships with. Android ships with SQLite version 3.4.0 per the android.database.sqlite package description in the Android website.
Hope this helps.
I had problems with this because my database was too large for many devices. You have to either save to external storage or download your database on-the-fly. The biggest disadvantage to storing your database in the APK is that you essentially double the size of your app at runtime.
What is the change that i need to do to implement an Iphone Database (.sqlite) to my android project?
Thanks for help
Android comes with SQLite3, you can either create your database from ground up or you can ship your application with a pre-populated database.
The following might prove useful:
1. SQLite Basics
2. Ship Android application with database
3. Using your own SQLite database in Android applications
Android also uses SQLite, so same DB should work.