Following my previous post it appears that it is not possible to write into the following app's data folders which are identified by:
cordova.file.dataDirectory
cordova.file.externalDataDirectory
Which are translated respectively into:
file:///data/data/my_app_id/files
file:///storage/sdcard0/Android/data/my_id_app/files/
and which both map to the same destination (the internal Android storage space):
.../sdcard0/Android/data/my_id_app/files/
When the app is installed, inside .../sdcard0/Android/data/ a directory named my_id_app is created with two subdirectories files and cache. The files directory has no write permissions:
If I try to write into cordova.file.dataDirectory no error is
reported. The operation seems to have been successful but it is
not. I cannot write into this directory even if the phone is rooted.
If I try to write into cordova.file.externalDataDirectory error code = 1 (file not found) is raised. Nothing can be written into this directory. I can read/write into this directory only if the phone rooted.
I did these tests on my Samsung S3 Mini (Android 4.1.2) and Phonegap Build 6.2. Nothing about these kind of permissions restrictions is specified or clearly explained in the official documentation at cordova-plugin-file.
I would like to write into the app's data directory because it's the only directory that it's removed when the user uninstalls the app. I don't want to leave pieces of my app into the user's phone if he wants to remove the app.
If these directories are not writable where should I save the files the app downloads and be sure they are removed when the app is uninstalled?
Any thoughts, explanations, suggestions? I'm missing something?
Related
I have a file Sharing app on the Play Store. The app can transfer selected apps and .OBB files associated with them. I am testing my app for android 11 but am unable to get obb files for apps even with ALL_FILES_ACCESS.
The android documentation states the following:-
Write access to all internal storage directoriesâ , except for /Android/data/, /sdcard/Android, and most subdirectories of /sdcard/Android. This write access includes file path access.
Apps that are granted this permission still cannot access the app-specific directories that belong to other apps because these directories appear as subdirectories of Android/data/ on a storage volume.
So, in theory, I should have been able to read any file except for /Android/data directory and write to any directory outside of /Android directory except for /Android/media.
Please correct me if I am wrong. If, access to obb is not possible this way, is there any other way or is my app's feature just ruined and user cannot transfer obb files at all?
If your app holds REQUEST_INSTALL_PACKAGES permission it can access Android/obb directory.
Yes there is a fix
In Play Store download Google Files.
If already installed.
Hold the app and goto app info,
In last allow both "modify system" And "install unknown app" and you can easily copy and move from and to obb and data folder from Google files.
Sorry for my bad English but I hope u can understand.
You just need to enable "install unknown apps" permission for any file manager app AFAIK, and you will have access. Worked on my Samsung device with Samsung my files app.
I made an Android activity and deploy it to my device using eclipse. Now i would like to add a INI configuration file to it.
What would be the right place to install this file on the device ?
I want want this configuration file to be modifyable without having to open the project using eclipse so that someone without programming knowledge or developping tools could still be able to modify this config file.
Thank you :)
What would be the right place to install this file on the device ?
External storage. It is the only place the user has access to.
You might package a template or starter version of your configuration file inside your app, such as in assets/, then copy that file to external storage on first run of your app (or if the user accidentally deletes or corrupts the copy on external storage).
I read that during .apk installation process a new user is created and with this new user rights, the Applications directory(.apk is extracted here) in the internal storage is created (in /data/app , not very sure). I can't find any Application directory in /data/app , even /system/app also contain .apk not Application directories . Can someone explain where I can find Application directories ??
Also what are the things happens during installation process (I am interested in knowing if some specific files are copied to specific location).
You read wrong :) APKs are not extracted on the file system, just decompressed in memory. So you will only find APK files in /data/app, /system/app, etc. The whole process is version dependent (for example Jelly Bean adds forward locking/encryption). You need to read the Android source to get the actual details. Start with PackageManagerService.java.
I know that the location for system apps is '/system/app' and the location for user apps is '/data/app'.
But I can't find the location of apk for the ones that I moved to/installed on sdcard.
Apps installed on the SD-Card are stored within the directory ".android_secure".
If I remember correctly you won't find the APK files directly in that folder because the content is encrypted. This is for preventing direct access to the APK file of paid apps.
The encrypted part is mounted somewhere else into the file system.
For me at least using cyanogenmod9 on a Samsung galaxy s 2 i777 I found them in /mnt/asec/
This location works differently than /system/app/ and /data/app/ because the system is actually creating a mount for each app rather than just stuffing them in a folder.
Make sure you take note of symbolic links.
You will not be able to add to here like you can the other two, but you can extract an apk. A better solution would be MyAppSharer from the market.
It will be in mnt -> asec -> -> pkg.apk
On Android 5.0+ (Lollipop, Marshmallow) almost every installed non-system app will be placed in:
/data/app/
Access to /data requires root.
Use su when you are working with adb shell to gain root access, this of course requires your phone to be rooted in the first place.
The directory contains a sub directory for every app.
Each sub directory is named by his package, following Androids app naming convention:
tld.author.appname-N
Where N represents a number greater or equal to 1
e.g. for Firefox it will look something like:
org.mozilla.firefox-1
Inside every app directory you will find a base.apk which is representing the installed app.
So if you want Firefox simply download:
/data/app/org.mozilla.firefox-1/base.apk
using adb pull/scp or copy it to your sdcard and download it using MTP.
Cheers
it is in
File Explorer--> mnt/sdcard
Install ES file explorer. Go to Home Page there will be link App...under that you will find all the apps installed on sd card or phone memory.. select app and share...enjoy...
On lineage 14, Android 7 , all sdcard apps are stored in /mnt/expand/
And apk in folder "app"
I would like my Robotium test to create a configuration file for the application I am testing to read. The file would be located in the internal storage /data directory associated with the tested application.
Is this possible? At the moment I am getting a "Permission denied" error.
Write shell script and push your file with adb root command.
If that doest not help you -create file inside your test.
It is actually possible to create files in data storage outside of an applications designated area. However, if these files are already generated by the target application, they must have WRITABLE permissions to enable the test application to modify them.
In my case my application does not generate the files, so this is not a problem.