I would like to get external root path. I got it like that:
root = File(Environment.getExternalStorageDirectory().absolutePath)
but after release android 10 it has become deprecated. I know that you will say that here I could find a lot of solutions but I didn't manage to solve my problem :( The most popular solution is that:
ContextCompat.getExternalFilesDir(String)
but this solution didn't help me. I also saw these questions: question_1,question_2 and documentation. The one solution which I see is to write smth like that: /storage/emulated/0/ and maybe it will do what I want. But maybe you have better solution for this task?
Related
I'm trying to get my hands on some system string resources in all languages available, where can I find them?
Edit: I'm searching for the xml files in the source code
The source code in the SDK doesn't include resources as far as I know and looked.
When I downloaded the Android Source tree, it kept downloading for hours and hours, it was more than 30GB of project data. Where should I start looking in this jungle of data?
Thank you
Edit:
answered by #zapl he/she gave me the answer I was looking for.
https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/strings.xml
Thanks to #zapl I got what I needed here https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/strings.xml
You can find them by programmatically like,
getResources().getString(R.string.yourStringResourse);
I've followed this tutorial and running this code. File and folder creation examples work fine. But example to "Retrieve file contents", "Creating file under a folder" doesn't work. They keep giving error message like this: "DriveId is not found. Are you authorized to see this file". I've made sure that the "EXISTING_FILE_ID" does exist (first, created a file and then used its file id to retrieve contents). I'm not sure what am I doing wrong.
Anyone out there got these examples working ?
The demos you're pointing to do work in my environment, and the way you put the question is too broad to answer. More like a complaint. You have to be more specific if you want to get a specific help (code causing problem, ...). So there is nothing to answer here...
I can only point you to another piece of code, this DEMO, that may get you off-the-ground. It takes a different path to show the basic GDAA's CRUD functionality of Google Drive. You may have a better luck.
I read the docs but I can't seem to figure out what the difference is. Is it something subtle that does not really matter? I want to create a cache of ten files. So when I went to use getExternalFilesDir, I noticed there is a getExternalCacheDir. So now I am confuse as to which one I should use (the name does not always tell the whole story). So can anyone put the difference in layman terms for me? thanks.
The ExternalFilesDir is not a cache, it will save your files, and they will remain there until the app is removed or the files manually whereas the cachedir will empty when needed
I'm a newbie to Android but would like to help you with the below link. The below article explores all possible ways / methods to use under different scenarios. It helped me in improving my understanding and hope the same with you and others as well
http://www.grokkingandroid.com/how-to-correctly-store-app-specific-files-in-android/
I'm trying to really get to know the android source code. I've downloaded what I thought would be the code, but it seems to lack many files that I would have expected there.
I'm looking for the hardware/hardware.c (cpp) file, and the hardware/power.c files.
Does anyone know where I could find some samples of this. Or perhaps where I could find a book on the topic.
I think it's here:
https://android.googlesource.com/platform/dalvik/
See also: Where to get the source to Dalvik?
I need to delete all the application data directories on the exit of an application:
/data/data/air.<appID>/cache/.AIR
/data/data/air.<appID>/cache/webviewCache
/data/data/air.<appID>/databases
But I get each time the "directory not found error"
Can anybody help me my a PRACTICAL code snippet? This is from my application descriptor:
<id>test01</id>
<filename>test01</filename>
<name>test01</name>
I know this is possible, but probably I'm typing in a wrong way the directories.
I know also this is not a best practice, but for security reasons I need to delete all the stagewebview cache and autofill form data.
File.applicationStorageDirectory is the thing you are looking for...
It points directly to the application's private storage directory.
Reference
the link is of not much help in this context. But I've found the solution. I was developing in debug mode so the correct application directory is /data/data/air.myappid.debug/ thanks anyway for the help! As of many of us know applicationdirectroy.nativepath gives an empty string on android.