Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get path to the temp folder from native code on Android?

getenv("TMPDIR") returns NULL. Any suggestions on what is temp folder/where to create one?

like image 904
Violet Giraffe Avatar asked Apr 26 '12 10:04

Violet Giraffe


People also ask

How do I find the temp folder on Android?

The temporary directory is /data/local/tmp .

How do I navigate to a temp folder?

On your keyboard, press the Windows + R keys at the same time. In the Open field, type %temp%, then press ENTER. The temp folder will open. You can also access it on your Windows 10 PC via the shortcut button below, then choose Temporary files.

Where are my temp files located?

For the windows client, temporary files are stored in the user's temporary folder, e.g. C:\Users\<username>\AppData\Local\Temp. For the web clients it is handled by the browser.

What are temporary files on Android?

Read More: Which Apps Slow Down Your Smartphone the Most? Temporary files are exactly what they seem: short-term files that run in the background. For example, when you hit “back” in an Internet browser, a temporary file remembers which page you were at before. Hitting “undo” on your keyboard also uses temporary files.


1 Answers

As far as I know there is no global /tmp in Android, you should use the cache dir.

Use getCacheDir() to get the "tmp" dir.

http://developer.android.com/guide/topics/data/data-storage.html#filesInternal and http://developer.android.com/reference/android/content/Context.html#getCacheDir%28%29

like image 107
Ruediger Avatar answered Oct 10 '22 05:10

Ruediger