I am creating a new app using phonegap (html and javascript) and am using an SQLite database. Due to phonegap limitations and my need for a dynamic database I am following these steps:
1 - creating an external database
2 - exporting this with the .apk file
3 - on app load I replace the phonegap database with my database
The issue I am having here is working out whether 'LocalFileSystem.PERSISTENT' or TEMPORARY. It looks like it is persistent. However, I am not sure how I can root my device allowing me to access and replace the database within the relevnt 'LocalFileSystem.PERSISTENT' section.
Thanks
By default your SQlite database is created at:
/data/data/Your Package/databases/your database
For using already created database see this.
Related
How can I view the DB in IntelliJ to view its content and perform operations on it. Now I have created my tables etc but i have no idea what data is on the DB and I do not want to create queries in java to check it. seems like a slow workflow so ill wait til I know how to access the db that resides on the Android emulator im using.
Is it possible?
You can also use Stetho. A nice debugging tool from Facebook.
Just simple to use, initialize it in your Application class and access your sqlite and even shared preferences from Google Chrome's developer console.
You can create a database file outside of Android and use any tool to create and read it.
Then, you place it in the assets folder and setup your code to read the database from there instead of private app data. Caveat here is that a copy will be made from the assets folder to the app data, so any updates within the app won't be mirrored to the database file in the assets folder.
I believe you can access the DDMS window in Intellij/Android Studio and there is a Database Explorer there
see #alexsimo's answer.
Without root you cannot access your database on your device, unless the file is created with a+r permissions.
Since that is something that is unrelated to the issue, you can just search in plugin.jetbrains.com for sqlite and get a variety of plugins.
I want to use my own sqlite3 database in my android project.
I created this database with command-shell line (windows) and exported it with SQLite Database Browser (sql format).
I followed this tutorial and my database can't be open :
go here to see since i can't post image
My package is org.opencv.samples and my DBName is "maif" placed in /assets directory.
So it seems that my exported database is incorrect, can someone helps me ?
I suggest to use this helper to solve your problems: https://github.com/jgilfelt/android-sqlite-asset-helper
I don't believe you can transfer an external database through the file system to Android unless you have a rooted phone. If you have to transfer data you need to use data transfer via HTTP using XML/JSON.
I have adopted Rhodes recently & I was wondering how to debug a Rhodes application. For example in Ruby we can see the line-by-line execution of code using irb. Also after creating the models in a Rhodes application, I want to see the database structure because I prefer to use the SQLite Manager as a Firefox plugin for my Rails apps.
I need to really see how the models look in the databases and how the attributes are stored.
Thanks
Using RhoStudio (built on top of Eclipse), you can set breakpoints and step through the Ruby controllers and models (source)
To see the database structure, you can access the file system and get the database's path, and save the SQLite database off in a web service or some other means (maybe to the SD card?) to view in your Firefox plugin, the following being an example of how to get the path to the database.
db_path = Rho::RhoFSConnector::get_db_fullpathname('app') # can be app, user, or local
EDIT
Or, if you build to RhoSimulator from within RhoStudio, you can navigate to the "bin" directory for RhoSimulator and inspect the SQLite files there.
/path/to/app/rhosimulator/db
If I created a database using another application not through android runtime, let's say using 'SQLite Manager'(firefox extention), how can I then use that database (the .Sqlite file that is generated) in my android application?
Since the SQLite is native in the android not an outsider database.
you can do it by preparing database file(.sqlite) from Sqlite Manager(firefox extention) and then use it in android see example
I've already created an android application that has got an already existing sqlite 3 database within it's asset's folder. I designed the application to copy the database on to the mobile when the app is launched for the first time. My question is how can I ship the database and the app so that users can easily install the app?
thanks
The method I'm going to show you takes
your own SQLite database file from the
"assets" folder and copies into the
system database path of your
application so the SQLiteDatabase API
can open and access it normally.
Have a look here : Using your own sqlite database in your Android applications