Class Request
Definition
- Namespace:
- Tizen.Content.Download
- Assembly:
- Tizen.Content.Download.dll
- API Level:
- 3
The Request class provides the functions to create and manage a single download request.
C#Copypublic class Request : IDisposable
- Inheritance
-
System.ObjectRequest
- Implements
-
System.IDisposable
Constructors
Declaration
C#Copypublic Request(string url)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL to download. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
Declaration
C#Copypublic Request(string url, string destinationPath, string fileName, NetworkType type)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL to download |
System.String | destinationPath | The directory path where downloaded file is stored. |
System.String | fileName | The name of the downloaded file. |
NetworkType | type | The network type which the download request must adhere to. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
System.NotSupportedException | Thrown when a feature is not supported. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
Feature: http://tizen.org/feature/network.wifihttp://tizen.org/feature/network.wifi.directhttp://tizen.org/feature/network.telephony
Request(String, String, String, NetworkType, IDictionary<String, String>)
Creates a Request object.
Declaration
C#Copypublic Request(string url, string destinationPath, string fileName, NetworkType type, IDictionary<string, string> httpHeaders)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL to download. |
System.String | destinationPath | The directory path where the downloaded file is stored. |
System.String | fileName | The name of the downloaded file. |
NetworkType | type | The network type which the download request must adhere to. |
System.Collections.Generic.IDictionary<System.String, System.String> | httpHeaders | HTTP header fields for the download request. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
System.NotSupportedException | Thrown when a feature is not supported. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
Feature: http://tizen.org/feature/network.wifihttp://tizen.org/feature/network.wifi.directhttp://tizen.org/feature/network.telephony
Properties
AllowedNetworkType
The allowed network type for downloading the file. The file will be downloaded only under the allowed network. If you try to get this property value before setting or if any other error occurs, the default value NetworkType All is returned.
Declaration
C#Copypublic NetworkType AllowedNetworkType { get; set; }
Property Value
Type | Description |
---|---|
NetworkType |
Remarks
Should be set before calling Start().
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
System.NotSupportedException | Thrown when feature is not supported. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
Feature: http://tizen.org/feature/network.wifihttp://tizen.org/feature/network.wifi.directhttp://tizen.org/feature/network.telephony
AutoDownload
Enables or disables auto download. If this option is enabled, the previous downloading item is restarted automatically as soon as the download daemon is restarted. The download progress continues after the client process is terminated. If you try to get this property value before setting, the default value false is returned.
Declaration
C#Copypublic bool AutoDownload { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The default value is false.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
ContentName
The content name of the downloaded file. This can be defined with reference of the HTTP response header data. The content name can be received when the HTTP response header is received. If you try to get this property value before calling Start(), an empty string is returned.
Declaration
C#Copypublic string ContentName { get; }
Property Value
Type | Description |
---|---|
System.String |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
ContentSize
The total size of the downloaded content. This information is received from the server. If the server does not send the total size of the content, the content size is set to zero. If you try to get this property value before calling Start(), 0 is returned.
Declaration
C#Copypublic ulong ContentSize { get; }
Property Value
Type | Description |
---|---|
UInt64 |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
DestinationPath
The file will be downloaded to the set the destination file path. The downloaded file is saved to an auto-generated file name in the destination. If the destination is not specified, the file will be downloaded to the default storage. If you try to get this property value before setting or if any other error occurs, an empty string is returned.
Declaration
C#Copypublic string DestinationPath { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Should be set before calling Start().
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
DownloadedPath
The absolute path where the file will be downloaded. If you try to get this property value before calling Start(), an empty string is returned.
Declaration
C#Copypublic string DownloadedPath { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Returns an empty string if the download is not completed or if a state has not yet changed to completed or if any other error occurs.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
ETagValue
The ETag value from the HTTP response header when making a HTTP request for resume. If you try to get this property value before calling Start() or if any other error occurs, an empty string is returned.
Declaration
C#Copypublic string ETagValue { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
The ETag value is either available or not dependent on the web server. If not available, then, on getting the property, a null value is returned. After the download is started, it can get the ETag value.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
FileName
The file will be saved in the specified destination or the default storage with the set file name. If the file name is not specified, the downloaded file will be saved with an auto-generated file name in the destination. If you try to get this property value before setting or if any other error occurs, an empty string is returned.
Declaration
C#Copypublic string FileName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Should be set before calling Start().
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
HttpHeaders
The HTTP header field and value pairs to the download request. The HTTP header <field,value> pair is the <key,value> pair in the dictionary HttpHeaders. The given HTTP header field will be included with the HTTP request of the download request. If you try to get this property value before setting, an empty dictionary is returned.
Declaration
C#Copypublic IDictionary<string, string> HttpHeaders { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.String> |
Remarks
HTTP header fields should be set before calling Start(). HTTP header fields can be removed before calling Start().
API Level: 3
HttpStatus
The HTTP status code when a download exception occurs. If you try to get this property value before calling Start(), 0 is returned.
Declaration
C#Copypublic int HttpStatus { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
The state of the download request must be DownlodState.Failed.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
MimeType
The MIME type of the downloaded content. If you try to get this property value before calling Start(), an empty string is returned.
Declaration
C#Copypublic string MimeType { get; }
Property Value
Type | Description |
---|---|
System.String |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
NotificationProperties
Contains properties required for creating download notifications.
Declaration
C#Copypublic Notification NotificationProperties { get; }
Property Value
Type | Description |
---|---|
Notification |
Remarks
When the notification message is clicked, the action taken by the system is decided by the application control properties of the NotificationProperties instance. If the app control is not set, the following default operation is executed when the notification message is clicked: 1) The download completed state - the viewer application is executed according to the extension name of the downloaded content. 2) The download failed state and ongoing state - the client application is executed. This property should be set before calling Start().
API Level: 3
Declaration
C#Copypublic DownloadState State { get; }
Property Value
Type | Description |
---|---|
DownloadState |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
Declaration
C#Copypublic string TemporaryPath { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
The download state must be one of the states after downloading.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
Declaration
C#Copypublic string Url { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Should be set before calling Start(). If you try to get this property value before setting or if any other error occurs, an empty string is returned.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
Methods
Declaration
C#Copypublic void Cancel()
Remarks
The canceled download can be restarted with Start().
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
Declaration
C#Copypublic void Dispose()
Remarks
After calling this method, the download request related data exists in the download database for a certain period of time. Within that time, it is possible to use other APIs with this data.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
Declaration
C#Copyprotected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
Declaration
C#Copyprotected void Finalize()
Declaration
C#Copypublic void Pause()
Remarks
The paused download request can be restarted with Start() or canceled with Cancel().
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
SetTemporaryFilePath(String)
Sets the directory path of a temporary file used in a previous download request. This is only useful when resuming download to make the HTTP request header at the client side. Otherwise, the path is ignored.
Declaration
C#Copypublic void SetTemporaryFilePath(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path |
Remarks
If the ETag value is not present in the download database, it is not useful to set the temporary file path. When resuming the download request, the data is attached at the end of this temporary file.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
Start()
Starts or resumes the download. Starts to download the current URL, or resumes the download if paused.
Declaration
C#Copypublic void Start()
Remarks
The URL is the mandatory information to start the download.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
Events
Declaration
C#Copypublic event EventHandler<ProgressChangedEventArgs> ProgressChanged
Event Type
Type | Description |
---|---|
System.EventHandler<ProgressChangedEventArgs> |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
Declaration
C#Copypublic event EventHandler<StateChangedEventArgs> StateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<StateChangedEventArgs> |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |