Where does the android emulator data lies? - android

Where does the emulator data lie(the contacts, messages, saved images)?

Go to ddms,you can find the file explorer from that you will get application directry and sd card filed you can find all the detailed files there.

In ~/.android (that is your user directory/.android)

Each application stores its own data in its own private folder in /data/data on the emulator. Depending on the application it potentially can also store data on the /sdcard (e.g. downloaded images or whatever) which by convention should then be in /sdcard/Android/data/com.yourappspackage.and.so/ so that it gets cleaned up with uninstall but many apps also throw stuff all over the sd card (although they should not..)
More is on the dev site e.g. at http://developer.android.com/guide/topics/data/data-storage.html
All this is the same for the emulator as well as the real device. The emulator is just a virtual machine running on qemu.

You can use File Explorer tool in eclipse or ddms to View The data in the emulator
else use terminal to view the data using the command,
adb shell
Thank you,
Ganapathy.

Related

Location of my package while USB debugging in eclipse

I searched a lot in DDMS all folders but can not find the location of my package folder in file manager. I have search it into the storage/sdcard0 but there also my package is not present.
take a look I uploaded photo. Is there any special setting from mobile ?
My phone android version 4.4.2
please help me to find.
UPDATE
I gone through this steps.
And I reach to My database folder .Now What to do.
adb shell
run-as com.mypackage
ls
cd databases
ls
Now After this what to do.
As you are looking for the database.
I used to copy the database file to any other location after updating it. ( in my code)
Then I use any sqlite viewer over phone or over PC to view it.
I Think you need a rooted device
as far as I know the files on sdcard/Android/data are not the primary files for the packages, those are only extra files (most probably not critical and large files) which are saved on the external storage which is the sdcard.
main package files are saved on the internal storage.
I think you can try this link
http://developer.android.com/guide/topics/data/install-location.html
you can change the location of app installation.
Br,
You can't see the files in DDMS, but you can get a list of the location of all the files using the command:
adb shell pm list packages -f
(you can also add an optional extra parameter to restrict the files listed to be those that match your extra parameter).
Once you have the location of the file, you can then issue a command like
adb pull /system/app/GoogleEarth.apk
to actually get the file off the device and on to your PC.
None of this requires a rooted device.
Since you're looking for the database of your application: Unfortunately there's no way to access the /data/data/your.package.name/databases through DDMS on an unrooted device, as Hussein Ali pointed out correctly. (By the way: The app-data (shared prefs, databases) will reside there no matter of the install-location)
Something like this won't work neither because of Permission denied.
adb pull /data/data/your.package.name/databases/db.sl3
Luckily ICS (Android 4.0) introducted the ability to backup your application-data. That's a possible way to copy your database from your unrooted device to your PC. Please see this post on StackOverflow in order to see what you need to do.
copy the database file to your SD card so you'll be able to use adb pull and get the database to your PC (You can't pull files from private folders such as /data/data/...).
I recommend using SQLite Expert to browse the DB on your desktop:
http://www.sqliteexpert.com/
Also, If you still want to use sqlite3 on your device, check out this answer: https://stackoverflow.com/a/7878236/624109
phone storage is treated as external storage in location "sdcard" where you havn't saved anything so nothing(package named folder) is created... your package will be in app's "private storage" that's in root "data/data/pkg_name" folder accessible only on rooted device.

Where does application data file actually stored on android device?

I have developed an Android app using Appcelerator Titanium. This app will create a file in applicationDataDirectory and install a database as well.
If run on emulator, I can locate those files using "adb" command. But how about on Android device? Can I use the "My Files" app to view those file I created? (since I can see files created by other application there.)
Moreover, I expect once I removed the app on device, it will automatically remove the related files and database. Is that true?
Because I found that even I removed the app from the device, the database seems left behind. I can tell because after deleting app and re-run on device(from Titanium), it show previous data.
I am using Ti SDK 2.0.1GA2, Android Runtime V8. And using Samsung Galaxy Tab for testing.
Thanks in advance.
Application Private Data files are stored within <internal_storage>/data/data/<package>
Files being stored in the internal storage can be accessed with openFileOutput() and openFileInput()
When those files are created as MODE_PRIVATE it is not possible to see/access them within another application such as a FileManager.
On Android 4.4 KitKat, I found mine in:
/sdcard/Android/data/<app.package.name>
Use Context.getDatabasePath(databasename). The context can be obtained from your application.
If you get previous data back it can be either a) the data was stored in an unconventional location and therefore not deleted with uninstall or b) Titanium backed up the data with the app (it can do that).
You can get if from your document_cache folder, subfolder (mine is 1946507). Once there, rename the "content" by adding .pdf to the end of the file, save, and open with any pdf reader.
This is a simple way to identify the application related storage paths of a particular app.
Steps:
Have the android device connected to your mac or android emulator open
Open the terminal
adb shell
find .
The "find ." command will list all the files with their paths in the terminal.
./apex/com.android.media.swcodec
./apex/com.android.media.swcodec/etc
./apex/com.android.media.swcodec/etc/init.rc
./apex/com.android.media.swcodec/etc/seccomp_policy
./apex/com.android.media.swcodec/etc/seccomp_policy/mediaswcodec.policy
./apex/com.android.media.swcodec/etc/ld.config.txt
./apex/com.android.media.swcodec/etc/media_codecs.xml
./apex/com.android.media.swcodec/apex_manifest.json
./apex/com.android.media.swcodec/lib
./apex/com.android.media.swcodec/lib/android.hidl.memory.token#1.0.so
./apex/com.android.media.swcodec/lib/libcodec2_soft_common.so
./apex/com.android.media.swcodec/lib/android.hardware.graphics.mapper#2.0.so
./apex/com.android.media.swcodec/lib/libcodec2_soft_vorbisdec.so
./apex/com.android.media.swcodec/lib/libcodec2_soft_h263dec.so
./apex/com.android.media.swcodec/lib/libhidltransport.so
./apex/com.android.media.swcodec/lib/libcodec2_soft_h263enc.so
./apex/com.android.media.swcodec/lib/libcodec2_vndk.so
./apex/com.android.media.swcodec/lib/android.hardware.graphics.mapper#2.1.so
./apex/com.android.media.swcodec/lib/libmedia_codecserviceregistrant.so
./apex/com.android.media.swcodec/lib/libhidlbase.so
./apex/com.android.media.swcodec/lib/libcodec2_soft_aacdec.so
./apex/com.android.media.swcodec/lib/libcodec2_soft_vp9dec.so
.....
After this, just search for your app with the bundle identifier and you can use adb pull command to download the files to your local directory.

Cannot find location of SQLite database file on Galaxy Nexus

I opened a SQLite database in my project. To see if the db was actually created I went to Data/Data to find the package name... not there. While testing I would like the ability to delet the file.
So I added data to the db, then read it out. This works fine, but still no file at either /Data/Data, or at /Android/Data/Data. Is the file hidden? Other dowloaded aps have data at /Data/Data/package/... but not the one I wrote. It does exist - I can read and write to/from it, but cannot find it.
//data/data/Your-Application-Package-Name/databases/your-database-name NOT THERE
Using a Samsung Galaxy Nexus for testing, not the emulator. The Nexus does not have external SD memory card.
SQLite databases are only accessible to the creating project, but is there a tool that can access it externally? I have sqlitebrowser (awsome) i will try if I can find the file.
I would try to Root the Nexus, but I can already see /Data/Data/ other items/Data/their data, so hopefully I do not have to go that route.
You're not able to access any contents of /data/data if you access it from adb shell without first rooting the device. Shell is considered as another app (more precisely another linux user), so it's prevented from accessing other app's data in /data/data.
Root the device or use emulator to see the data.
Personally I really recommend rooting the device for development.

Putting files in emulator external storage, prior to app starting

Using the emulator, with external storage attached, I would like to emulate what happens when the application starts up and certain files are already present in the relevant directory on ext storage.
Is the external storage actually located on my machine, after enabling it in the AVD? Or should I be creating the files with some temporary, throw away code? Or should I just test on a real device?
What is best practice for this scenario?
The sdcard.img is in the avd folder (~/.android/avd). If you are using Linux or OSX you can mount it, manipulate the files inside, and unmount it.
Probably there's a program in Windows that let you do the same.
As an alternative, you can start the emulator and then manipulate the sdcard content using adb push/pull or DDMS.
The easiest way of creating the SDCard contents, would be to create the files that you need on your machine and then using the DDMS Perspective in Eclipse you can select your emulator in the Devices panel on the left, and then choose the FileExplorer tab on the right. There is a folder named sdcard which contains the SDCard contents.
By using the controlls on the right upper-side you can create folders inside the SDCard and by you can also Push files on the emulators SDCard.
As #dtmilano said, you can also achieve the same thing using Command Prompt.

Reading database file from android device

I've been trying to pull a copy of my sqlite database from my android app for dev. My first attempt was to call:
./adb shell
cd data/data
cd com.example.app
cd databases
But then I get stuck here as I do not have permission to do a pull or even view the files in that dir!
So I thought I'd try out the DDMS File Explorer which gives me this:
But when I try and pull files from here (I would expect them to be in the data folder) it just pulls the directory and nothing else. How can I do this to pull a copy of the database my app is creating/using?
I have tried this when the phone is on the SD card and on phone memory. I guess I could copy to SD card and then plug the SD card to pc rather than the phone and do it that way? Not sure if it would work and would be rather annoying to dev like that!
Thanks
If your device does not give you access to this directory (and your device is not rooted -- if you become root, you'll have access), you will need assistance from your application.
The application can, for example, copy databases/your_database_name.db to a readable location, perhaps on the SD card. Then you can pull from there.
IF you just need the DB for general checking/viewing you can run your app on the emulator and get the DB from there. If you need the specific instance on your device you need to root your device as others are suggesting.

Categories

Resources