In the app I was helping developing, the users seen that each time they use apps like CM Security to clean 'junk', the files inside the folder associated with the app were instead considered as 'junk' and are deleted.
The app itself would create the folder in the C side of the code instead of using Java.
Firstly, when the app is first launched, custom C code will check if the app folder (e.g. 'Game') exists. If it doesn't, it makes it (regardless of OS. The app is cross-platform, sorry I forgot to say it.) It puts it in the external SD card ('sdcard/'). When it's seen, it can now run the app.
I get about the getFilesDir, but since the directory is made using C code and not through the java activity, it doesn't count as its app directory.
Is there a way to link the folder to the Android code so that it would be recognized as the app folder?
Related
Trying to make some sense of this complete mess of scoped storage.
So I'm storing some files (logs) generated by App A inside the Download folder.
I'm using Mediastore/ContentResolver and no problems with that either for read or write access as long as it's from App A.
But then App B needs to read these files and here comes the problem.
Same way using Mediastore/ContentResolver but the files seem invisible for queries.
Download is supposed to be a Shared Storage, but files are indeed generated as -rw-rw--- which means no permission for others which could explaind why App B does not sees files from App A if they are not in the same group.
Would the Storage Access Framework method work around this?
Thi not tried it yet because poping system window's is definitely not something I wanted as a user experience for my App.
Thanks.
If the second app has 'all files access' with MANAGE_EXTERNAL_STORAGE it can also list the files of the first app.
Otherwise you can let the user of the second app pick those files with ACTION_OPEN_DOCUMENT of Storage Access Framework.
You better store your files in a sub directory as then second app can pick complete directory with ACTION_OPEN_DOCUMENT_TREE and list all the files.
I want to create a folder with pictures just in installation.
I searched a lot for this but I didn't found nothing but a lots of apps do that. I speciffically mean the Android folder in /storage/emulated/0/ or /sdcard/.
That is not possible, sorry. You are welcome to create directories and files when your app is run by the user. There is no option for doing so just because your app is installed.
you can create the folder after the app is installed.. However you can design your code such that it creates folder while loading the Application for first time.
I have created an Android Application that should be used in different social environments (shops, airports, etc.)
Each of those wants their own profile (their own background, button colours,etc.). I recieved .bak files which hold this Profile`s, but I need to somehow include them inside the Application Folder, so that they get detected.
I cannot find the Application Folder on my Computer, when I connect my Android Device to it via USB cable (so that I can copy / paste the .bak to that folder). Can anyone help me out here?
You can access your app folder like this
getContext().getExternalFilesDir(null).getAbsolutePath()
For using permissions WRITE_EXTERNAL_STORAGE and/or READ_EXTERNAL_STORAGE are required.
And for first-time application launch is not better to put your .bak file with profiles to assets, and when apk will start first time copy to app-folder in background? Usually app-folder have path like "sdcard/Android/data/your_app_package_name/files" but if u did not write something to this folder, folder will not be created.
According to the Android Development Documentation, you can't just open any file you want ("Open a private file associated with this Context's application package for writing.").
What, however, when I want my application to read files created by other applications? Let's say I have a file in /data/app_1/hello.txt, but my application has nothing to do with it because my app is called app_2, how would I still be able to open this file (and write back to it)?
You can't in general, Applications on Android are isolated and sparated. A application can only write and read its own files.
There are exceptions: As the documentation states: "It's possible to arrange for two applications to share the same Linux user ID, in which case they are able to access each other's files. To conserve system resources, applications with the same user ID can also arrange to run in the same Linux process and share the same VM (the applications must also be signed with the same certificate)."
Another possiblity is that the files are created as "world readable" so that every application can read it.
So to summarize and come back to your question: If you can not modify "my_app_1" then it is impossible. Of you can modify both applications choose one of the solutions above.
Two options:
If you are designing both applications and want to share the file, keep it somewhere else (for example - external storage) or make it world readable.
If you are trying to read another app's file - well, you shouldn't, that's a key element in the android security architecture.
I am currently programming an "One time after first login tutorial" and since it should be only shown one time after the user starts the application for the first time, I would like to remove all the unnecessary files like for example pictures which I only use in this tutorial.
So is there a way to remove some of these files which are shipped within the .apk ?
The Android apk is a read only file, so once a file is part of an apk, it cannot be removed.
An option would be to download the files from the network the first time the user installs the app and then put it on the sd card or locally and then delete it when you want it.