I want to store music files downloaded from server in my application installation directory. I noticed that several android phones has different path to application installationo directory.
Such as Android/data, data/data and etc.
I develop the application with phoengap. I checked their api but coudnt get a methode that return application installaitn folder path.
Can anybody help me on this?
thanks
Due to security reasons, you cannot write to application install or the assets directory, instead you can write files in application data folder.
http://cordova.apache.org/docs/en/2.9.0/cordova_file_file.md.html
Related
I'm doing a practice application in which I do a CRUD in android studio 3.0.1 and I'm running the application directly on my cell phone.
The application works without any inconvenience but when I want to remove the BD in SQlite from the application to analyze the fields from my pc I can not find the directory associated with my application
And checked the memory of the cell where all the applications are and I can not find the folder associated with it.
Could you tell me if it is stored in some hidden directory or something, because I can not find the folder associated with my application?
Note: I also have an external memory in my cell phone which has been reviewed folder by folder but nothing.
And checked the memory of the cell where all the applications are and I can not find the folder associated with it.
You are looking at external storage. Your app will not have a directory there, unless you create one in your code.
Could you tell me if it is stored in some hidden directory or something
Your APK is not stored anywhere that a user can see, except perhaps on a rooted device.
I also have an external memory in my cell phone which has been reviewed folder by folder but nothing
That is removable storage. Your app will not have a directory there, unless you create one in your code.
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
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.
Im currently in the process of byuilding an app with phonegap on android.
I Prepared a "spoof app " with tests of some functionnalities i wanted to try before starting to develop fully.
I built my app and signed it so i may install it on my phone with the apk.
The problem is , my app works fine but i cant find the file system of the app in any of the devices i tested the app on. I wanted to retrieve the SQLite database or a file i created but i cant because i cant find the filesystem of the app in the device.
Is there anyway other than rooting the device to see my app in the phone filesystem when plugged with usb?
Or is there any way i can retrieve easily the databases my app created on the phone?
EDIT: my devices dont have SDCARDS and doesnt support SDCARDS either.
PROBLEM SOLVED
Since i found out that i would have to root the phone or the tablet to acess the filesystem i review my app functionnalities and i found out i could create a foler on the phone with phonegap , but still i couldnt see it.
I then opened the DDMS perspective in eclipse and looked throught the filesystem and found out that the folders i saw in my phone were in the mnt folder, in the sdcard directory. (mnt/sdcard)
I then used the filesystem acess of phonegap to create a directory on my phone.
fileSystem.root.getDirectory("**/mnt/sdcard/com.seventest.com**",{create:true, exclusive: false},gotDir,fails);
So now i can access a directory and push anything in it i need to access for my app to work with.
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.