Cant generate folders contains Offline Database after Android APK installation - android

I use SQLite as my offline database. After the APK installation, I couldn't find the folders that I made. I want to put the database in device Storage : /storage/emulated/0 (Samsung device where I tested my program).
I already put this in my manifest :
<manifest android:installLocation="preferExternal" />
To install APK, i copied it directly from bin to my phone external storage. Did I miss something?
**notes: I need for users to be able to access files (.TXT and .XML) from device storage, so the folders and files inside shouldn't be hidden.
I'd appreciate your kind reply.. Thanks

installLocation="preferExternal" refers to the app installation, not to an eventual database (which I don't see mentioned anywhere in your question, other than in its title).
i copied it directly from bin to my phone external storage. Did I miss something? YES: this is not enough.
You have to install the apk, after copying it - you'll need a file manager to launch it.
OR (better) activate your Debug Options and run the app from the IDE directly onto your phone (you'll need to install the ADB Bridge, aka USB driver, aka ADB Composite Interface).
so the folders and files inside shouldn't be hidden. Every file in the apk is private to your app.
Other than this, your SD Card and then use them from there.
Use Environment.getExternalStorageDirectory() to get the path to your SD Card.
If you need some clarification on databases, please post a specific question about that matter.

Related

In which folder is my android application?

I created an Android app which is storing some info on the database. I copied .apk file to a folder, clicked on it, it was installed and the app is working. But I cannot find in which folder the app is is located - I want to backup the database. Any ideas?
Thanks,
zb
The app will normally be installed in /data/app directory - it would usually be just the copy of your APK, although not always. The databases, unless you explicitly specified a different location in your code, will be in
/data/data/your.package.name/databases
The package name will be something like com.yourcompany.appname.
Note that backing the data by copying the databases is not the right way to backup your files. Use android backup instead. Also, unless your phone is rooted, you may not be able to get to these databases.
Zalek
Here the location for the app to be searched
MyApp/myapp/build/outputs/apk/myapp-debug.apk
Note: "MyApp" is your project name of your app. I just take an example as myapp

How does Android File Storage Work?

I am working on a project that needs to store some .txt to android, and get it from the computer for other use. From what I read from the documentation, I know that there are two types of storage: 1 Internal, which is somewhere deep in the phone that is private to the app. 2 External, which includes the SD card and the Internal Storage of the phone. I want to store it to External->Internal, and I am using this line of code to do that:
public String WalkDir = android.os.Environment.getExternalStorageDirectory().getAbsolutePath() + "/Walks/";
When I logged WalkDir, LogCat says "/storage/emulated/0", I stopped the app, checked with the adb shell, and there is no folder "0" but "legacy". I unplugged the phone and plugged it back in, the "Walks" folder is now in the root directory, and I don't need adb shell to access it.
So my question is, can you help explain how this system works? Why did "0" disappear? What is "legacy"? Why is the file in Internal Storage when I unplug&plug it?
Thank you very much!
Those are what in Linux are called symlinks (like shortcuts in Windows) that various system apps in Android are using..
/storage, /sdcard are sym linked folders,that means when you open one of those, it redirects to the original(/data/media/0), as for the 0 is just a multi user feature implemented in android 4.2, but only enabled on tablet androids.
Why do this Sym-Link?: simple so it dosent break apps(not only file explorer type of app, but all apps).
Still dont get, why it would break?.Simple. android api have lots of ways to write/read files from folders, u can do manually,u can get the data path, u can get the sdcard path, etc,etc. so to not break that they just does these sym links, thats why in one app the storage contentents are listed on /sdcard but on others, is /storage, etc,etc. one example of an app that broke because of these changes to android is titanium backup, u need to change the internal storage on it, so it work.
2 mount points pointing to the same storage device and partition.
If you create something in one folder, it will show up in the other. Same applies for deleting stuff.
They do not take away more storage space, as it is only available once but shown twice.
You also don't need to worry about it in any way because file browsers normally set their default directory to one of these locations.
As far as i know, Google changed the mount points in Android 4.2 to /storage/emulated/0/ due to them switching to MTP and EXT4(?) for the sdcard. The other mount points are still there for compatibility.

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 is android application installed in my sd card

I just want to view the files(especially the .png files) associated with one of the application in my mobile. The application is actually installed(moved) in the SD card.
The issue is ..I could not find the application in the SD card. I am using a file browser called 'File Manager' to browse through the SD card. Can someone help me on this.
It should be here:
/mnt/sdcard/Android/data/your_package_name/
Some hardware implements the path to the external storage different.
/mnt/sdcard/Android/data/your_package_name/
/mnt/sdcard-ext/Android/data/your_package_name/
You may be able to get a better view of what is on the device by using the ADB Shell. If you still have trouble at this point trying running grep or find from the shell.
UPDATE
Most of the time the files associates with your application are in the directory with your application. The application is installed in /data/data/your.package.name/. However you will need root access to get here if you are on a phone, I think the emulator lets you get here. As far as external storage... yea its a pain, to much fragmentation in the market. You have to programmatically check the location of the external storage.
On my device with Android 2.3.6 apps moved on the SD card are located into a directory named .android_secure as .asec files (see http://www.fileinfo.com/extension/asec).
They are not visible from the standard "Archive" browser which shows the hidden directory as empty.
The files are also encrypted so I guess no access to the images within is possible.

Is there a simple way to have external properties for an android APK?

I have an android application that gets invoked through ADB on a desktop machine. I have a properties file on the desktop machine which the android application somehow needs to be aware of, but they need to be external to the APK.
On the desktop (which will invoke the activities within the APK via ADB) I cannot easily repackage the APK with the .properties file and then re-install the APK on the phone (I tried this via aapt, but it is not preferable because it removes the signature on the APK and I cannot easily resign the apk on the particular desktop machine).
I would rather not pass them via intent extras, as there are a lot of them, and I cannot use adb shell setprop because it doesn't work while the phone is running. I also cannot put them on external storage because I am not guaranteed the phone will have an SD card. Can I put them in "internal storage" somewhere (if that exists) ?
I basically need to be able to pass numerous properties onto the device when I install the APK, but I cannot put them in the APK itself, and not all the devices will have SD cards.
Any ideas ?
Take a look at the method used here: android: transfer sqlite database from pc to device via usb programatically

Categories

Resources