共用方式為


MbmsDownloadSession.TempFileRootDirectory Property

Definition

Retrieves the currently configured temp file root directory. -or- Sets the temp file root for downloads.

public virtual Java.IO.File? TempFileRootDirectory { [Android.Runtime.Register("getTempFileRootDirectory", "()Ljava/io/File;", "GetGetTempFileRootDirectoryHandler", ApiSince=28)] get; [Android.Runtime.Register("setTempFileRootDirectory", "(Ljava/io/File;)V", "GetSetTempFileRootDirectory_Ljava_io_File_Handler", ApiSince=28)] set; }
[<get: Android.Runtime.Register("getTempFileRootDirectory", "()Ljava/io/File;", "GetGetTempFileRootDirectoryHandler", ApiSince=28)>]
[<set: Android.Runtime.Register("setTempFileRootDirectory", "(Ljava/io/File;)V", "GetSetTempFileRootDirectory_Ljava_io_File_Handler", ApiSince=28)>]
member this.TempFileRootDirectory : Java.IO.File with get, set

Property Value

A File pointing to the configured temp file directory, or null if not yet configured.

Attributes

Remarks

Property getter documentation:

Retrieves the currently configured temp file root directory. Returns the file that was configured via #setTempFileRootDirectory(File) or the default directory #download(DownloadRequest) was called without ever setting the temp file root. If neither method has been called since the last time the app's shared preferences were reset, returns null.

Java documentation for android.telephony.MbmsDownloadSession.getTempFileRootDirectory().

Property setter documentation:

Sets the temp file root for downloads. All temp files created for the middleware to write to will be contained in the specified directory. Applications that wish to specify a location only need to call this method once as long their data is persisted in storage -- the argument will be stored both in a local instance of android.content.SharedPreferences and by the middleware.

If this method is not called at least once before calling #download(DownloadRequest), the framework will default to a directory formed by the concatenation of the app's files directory and MbmsDownloadSession#DEFAULT_TOP_LEVEL_TEMP_DIRECTORY.

Before calling this method, the app must cancel all of its pending DownloadRequests via #cancelDownload(DownloadRequest). If this is not done, you will receive an asynchronous error with code MbmsErrors.DownloadErrors#ERROR_CANNOT_CHANGE_TEMP_FILE_ROOT unless the provided directory is the same as what has been previously configured.

The File supplied as a root temp file directory must already exist. If not, an IllegalArgumentException will be thrown. In addition, as an additional correctness check, an IllegalArgumentException will be thrown if you attempt to set the temp file root directory to one of your data roots (the value of Context#getDataDir(), Context#getFilesDir(), or Context#getCacheDir()).

Java documentation for android.telephony.MbmsDownloadSession.setTempFileRootDirectory(java.io.File).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to