Most applications typically choose the location of the cache as the/sdcard/android/data/<application package>/cachepath.
There are two benefits to choose from in this location:
First, this is stored on the SD card, so even if more data is cached it will not have any effect on the phone's built-in storage space as long as the SD card space is sufficient.
Second, the path is identified by the Android system as the application's cache path, and when the program is uninstalled, the data will be erased together, so there will be no more residual data on the phone after the removal process.
//Path Example:/SD card/android/data/program's package name/cache/uniquename Private StaticFile Getdiskcachedir (context context, string uniqueName) {string CachePath; if(Environment.MEDIA_MOUNTED.equals (Environment. Getexternalstoragestate ())|| !environment.isexternalstorageremovable ()) {CachePath=Context.getexternalcachedir (). GetPath (); } Else{CachePath=Context.getcachedir (). GetPath (); } return NewFile (CachePath + file.separator +uniqueName); }
Get the SD card under android/data/file