I implemented my first app using Xamarin Studio (Mono for Android). This app stores some data in a SQLite db, which works fine on a Sony Tablet S device.
My question is: is there a way to get db file and see, for example, its size?
I looked up to the following path
/data/data/My-Application-Package-Name/databases/My-database-name
but it doesn't seem to exist.
Thanks for any help!
You can use Eclipse to go right to it using the sqlite manager plug-in (http://www.coderzheaven.com/2011/04/18/sqlitemanager-plugin-for-eclipse/)
Download the *.jar file from the website I reference above to the
"dropins" folder in eclipse (open your eclipse folder and you should
see it)
Then restart eclipse and go to the DDMS. You may have to do
windows->views-ddms if it isn't already being displayed...
Select your device from the left panel then use the file explorer to go to your data
directory/YOURAPP/databases. Hopefully there will be an icon that
shows up when you select your database. If not, rename your database to use the "db" ext.
Click it and it should open in the manager tab.
This is a valid database location (//data/data/My-Application-Package-Name/databases/My-database-name), but you can access it from file managers if you have root access only.
Look how it can be done here. Otherwise, if you want to get some info trough the code, you're doing something wrong, so publish the code and logcat.
Related
I've created an app using Android Studio and it has a database file handler. I've gone through a few post and everywhere they are saying go to data\data\ folder to get the app folder. But mine doesn't show any folder for my app. Do I have to manually set this file location to be created? How can I find my database.db file?
It should be automatically placed in data/data/databases in your app folder unless you specify otherwise. Are you sure it is created?
That is /data/data/package-name/databases/dbfilename
I have another suggestion. If you have enabled backup for your application, you might be able to use ADB BACKUP, like suggested here: http://blog.shvetsov.com/2012/09/backup-your-android-without-root-or.html
The database files are located in the following folders.
/data/data/packagename/databases/
You can access the .db file only on emulator, its not possible on actual device. In the android studio open the DDMS perspective, there on the left hand side you will find the storage structure, there in data/data/ you will get the file you are looking for
it's my first question here. I searched a lot on the site but didn't find any answer for my question.
Basically, I want to load a directory containing jpeg and mp3 in the tablet and retrieve the path from these files and put them in a SQLite database. I have no trouble using the database but I don't know how to retrieve the paths of the files or even to verify the existence of the directory. Any hint on how to access these files without putting them in the application drawable and sound folder would be appreciated. Thanks!
Goto the Android Device Monitor in the android studio and new poup window will open with the devices list in the left pane and in the right pan select the File Explorer Tab and that's it
I am new to alloy mvc framework.I was working in projects using SQLite.I kept SQLite file in asset folder and did query works in application.
An instance of SQLite file is created in simulator folder. My question is can we see database file in ios ,android device and where it is stored in device.
Please suggest me ..
Thanks in advance.
In Android, you can find your database at this location
/data/data/your.package.name/databases/your_db_name.db
for iOS simulator, you can find the database at this location :
/Users/USER_NAME/Library/Developer/CoreSimulator/Devices/NOW_SELECT_YOUR_DEVICE/data/Containers/Data/Application/SELECT_YOUR_APPLICATION/Library/Private Documents/
Normally USER_NAME/Library the Library folder is hidden, you have to unhide it first.
You can use the Xcode's Organiser to access the database on the device.
First open the Xcode's organiser, then select your device, then choose your application, now download container from below settings icon, you will get an .xcappdata file.
Now select the downloaded container i.e. .xcappdata file and Show Package Contents. Now go in AppData/Library/Private Documents. Here you will get the database of your application.
Hope this will help you.
I downloaded the jar file and placed it in /plugins directory. Restarted eclipse as asked for eclipse to load new plugin. Opened file explorer and navigated to /package.name/databases/file.db but not able to open it in the plugin. It appears unclickable. What to do here? Check screenshot.
From the emulator unistall the app.
Then in the code, when you create the database, name it with extension.
For e.g. if your database name is MyDB, then write it as MyDB.db
This will enable the Open File Icon on sqlite manager on eclipse.
As from your Screenshot it is clear that your database doesn't have an extension currently.
Therefore it is not allowing to open the database file but if you can see here
You can delete the database from here using the "-" option delete both the database and .journal file.
Add .db extension where you are creating the ordersManager database and run the application again.(Remeber to create the database)
when you will again come to DDMS to see your database and click on ordersManager.db file the icon which i have circled will become enabled then click on it and you will be able to read data.
Also you can pull the database from device and use something like SQLLiteBrowser
Here are thr few useful links :
1) Link 1
2) Link 2
The mistake that you are doing is that you didn't mention the ".db" extension with your db name. Delete your previous db and name a new db with .db extention i.e. "Sample.db" try it i hope it will solve your problem.
You have to mark the database like you did in your screenshot but then you have to click the database icon in the top
also its better to place the plugin in the dropin folder because you haven't loaded it by a url
Try this download SQLite3 manager from this http://sqlitemanager.en.softonic.com/ . And install it.And pull your database (i.e. file.db ) from DDMS to now location and try to open it with using Sqlite3 manager.
And you will be able to see your database contents.
I think this is what you want.
Try this..
Download the Android Sqlite Manager here.
Add it to your eclipse > dropins Directory.
Restart eclipse and go to DDMS.
Select .db file in DDMS Perspective
click Sqlite Manger icon.
Now you're able to open the .db file.
I am working with SQLite in an App. It writes to the database, etc., with no problem. However, I can not find this new database. I have tried changing the directory with cd /data/data/packageName/databases, but it says "no such file or directory". Also, this database is not found when I click on the File Explorer in eclipse. My logging tells me the database was created and that it is being written to. I think I need to set the path in the shell or something to that effect using adb, but I have no idea how to do that. Can anyone give me some instruction? Also, I am using my phone for development. The database also does not show up when using the emulator.
Thanks very much.
Matt
Matt,
This thread gives a good explanation on why you might not be able to access the data folder on your phone.
Can't access data folder in the File Explorer of DDMS using a Nexus One!
You can still test the Sqlite code though. Just boot up an emulator. The emulator will have no access restrictions. Once it's booted up you can use the ddms tool (located in the tools directory under your android SDK install folder). It has a File Explorer and you can download the files from the /data folder.
Also, I am using my phone for development.
You cannot access the database on a standard Android device except via your own application code.
Your options are:
Do this sort of testing on an emulator, in which case you can access the directory that you are failing to access on the device
Add a database backup feature to your app, that copies the (closed) database to external storage, so you can examine it
Root your phone (leastways, I am under the impression this can help get you to this directory -- haven't done it myself)
The database also does not show up when using the emulator.
Try harder. If you can store data in the database and read data out of it using SQLiteDatabase, then the database file is there.