Tizen Native API  10.0

The DOWNLOAD API provides functions to create and manage one or more download requests.

Required Header

#include <download.h>

Overview

The DOWNLOAD API provides functions to allow developers to control and monitor the download of files from the web, providing flexibility and control over the download process.
It is ideal for scenarios where large files, images, or media content need to be downloaded for offline use.
The module supports key operations such as starting, pausing, resuming, and canceling downloads, as well as offering fine-grained control over notifications, network settings, and caching behavior.
The API is designed to be highly configurable, allowing developers to tailor the download process to their application's specific needs.

Major features :

  • Download Management: The module offers functions to create and destroy download handles, start and stop downloads, and query the download state.
  • Network Control: Developers can specify network types for the download, such as Wi-Fi or data network, and retrieve the current network type.
  • Download Progress Tracking: Progress of ongoing downloads can be monitored through callback functions.
  • File Management: The API allows developers to set the destination path for the downloaded file, retrieve the temporary file path, and manage file naming. Additionally, file metadata such as content size and MIME type can be queried.
  • Notifications: The module provides extensive control over download-related notifications.
  • HTTP Headers: For advanced use cases, developers can add and retrieve custom HTTP headers for download requests.
  • Caching: The module supports caching, allowing downloaded content to be reused without redownloading.
  • Error Handling and Status Monitoring: The API includes functions for retrieving the HTTP status of a download request and checking the last occurred error.

Related Features

This API is related with the following features:

  • http://tizen.org/feature/download
  • http://tizen.org/feature/network.telephony
  • http://tizen.org/feature/network.wifi
  • http://tizen.org/feature/network.wifi.direct

It is recommended to design feature related codes in your application for reliability.

You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.

To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.

More details on featuring your application can be found from Feature Element.

Functions

int download_create (int *download_id)
 Initializes a new download request and returns download ID that can be used to control the download process.
int download_destroy (int download_id)
 Frees the resources associated with a previously created download ID.
int download_set_url (int download_id, const char *url)
 Sets the URL for the file to be downloaded.
int download_get_url (int download_id, char **url)
 Gets the URL for the file to be downloaded.
int download_set_network_type (int download_id, download_network_type_e net_type)
 Sets the type of network (e.g., Wi-Fi) that should be used for the download.
int download_get_network_type (int download_id, download_network_type_e *net_type)
 Gets the current network type that is set for the download.
int download_set_destination (int download_id, const char *path)
 Sets the file path where the downloaded content will be saved on the device.
int download_get_destination (int download_id, char **path)
 Gets the file path where the downloaded content will be or has been saved.
int download_set_file_name (int download_id, const char *file_name)
 Sets the name to be used for the downloaded content.
int download_get_file_name (int download_id, char **file_name)
 Gets the name of the downloaded content previously set by download_set_file_name().
int download_get_downloaded_file_path (int download_id, char **path)
 Gets the absolute file path of the downloaded content.
int download_get_mime_type (int download_id, char **mime_type)
 Gets the MIME type of the downloaded content.
int download_set_auto_download (int download_id, bool enable)
 Enables or disables automatic downloading of the file.
int download_get_auto_download (int download_id, bool *enable)
 Gets whether the download is set to start automatically.
int download_add_http_header_field (int download_id, const char *field, const char *value)
 Adds an HTTP header field to the download request.
int download_get_http_header_field (int download_id, const char *field, char **value)
 Gets the value of a specific HTTP header field that was added to the download request.
int download_get_http_header_field_list (int download_id, char ***fields, int *length)
 Gets a list of all HTTP header fields that were added to the download request.
int download_remove_http_header_field (int download_id, const char *field)
 Removes a specific HTTP header field from the download request.
int download_set_state_changed_cb (int download_id, download_state_changed_cb callback, void *user_data)
 Sets a callback function to be called when the download state changes.
int download_unset_state_changed_cb (int download_id)
 Unsets the callback function for the download state changes.
int download_set_progress_cb (int download_id, download_progress_cb callback, void *user_data)
 Sets a callback function to be called to track the progress of the download.
int download_unset_progress_cb (int download_id)
 Unsets the callback function for the download progress.
int download_start (int download_id)
 Starts or resumes the download process asynchronously for the given download ID.
int download_pause (int download_id)
 Pauses an ongoing download asynchronously.
int download_cancel (int download_id)
 Cancels an active download, asynchronously.
int download_get_state (int download_id, download_state_e *state)
 Gets the current state of the download, such as whether it is in progress, paused, canceled, or completed.
int download_get_temp_path (int download_id, char **temp_path)
 Gets the temporary file path where the partially downloaded content is being stored.
int download_set_temp_file_path (int download_id, char *path)
 Sets the temporary file path used in the previous download request.
int download_get_content_name (int download_id, char **content_name)
 Gets the content name of downloaded file.
int download_get_content_size (int download_id, unsigned long long *content_size)
 Gets the size of the content being downloaded.
int download_get_error (int download_id, download_error_e *error)
 Gets the last error that occurred during the download process.
int download_get_http_status (int download_id, int *HTTP_status)
 Gets the HTTP status code when the download error occurs.
int download_set_notification_app_control (int download_id, download_notification_app_control_type_e type, app_control_h handle)
 Sets an app control handle to register notification messages.
int download_get_notification_app_control (int download_id, download_notification_app_control_type_e type, app_control_h *handle)
 Gets the app control handle which is set by download_set_notification_app_control().
int download_set_notification_title (int download_id, const char *title)
 Sets the text to be displayed in the download notification.
int download_get_notification_title (int download_id, char **title)
 Gets the title text that is set to be displayed in the download notification.
int download_set_notification_description (int download_id, const char *description)
 Sets the description text to be displayed in the download notification.
int download_get_notification_description (int download_id, char **description)
 Gets the description text that is set to be displayed in the download notification.
int download_set_notification_type (int download_id, download_notification_type_e type)
 Sets the type of notification to be displayed during the download process.
int download_get_notification_type (int download_id, download_notification_type_e *type)
 Gets the type of notification currently set for the download.
int download_get_etag (int download_id, char **etag)
 Gets the ETag (Entity Tag) from the server response for the download request when making a HTTP request for resume.
int download_set_cache (int download_id, bool enable)
 Enables or disables the use of cache for the download.
int download_get_cache (int download_id, bool *enable)
 Gets whether caching is enabled for the download.
int download_reset_cache (void)
 Clears previously cached data.

Typedefs

typedef void(* download_state_changed_cb )(int download_id, download_state_e state, void *user_data)
 Called when a download state is changed.
typedef void(* download_progress_cb )(int download_id, unsigned long long received, void *user_data)
 Called when the progress of download changes.

Typedef Documentation

typedef void(* download_progress_cb)(int download_id, unsigned long long received, void *user_data)

Called when the progress of download changes.

Since :
2.3
Remarks:
This callback function is only invoked in the downloading state.
Parameters:
[in]download_idThe download ID
[in]receivedThe size of the data received in bytes
[in]user_dataThe user data passed from download_set_progress_cb()
Precondition:
This callback function is invoked if you register this callback using download_set_progress_cb().
See also:
download_cancel()
download_set_progress_cb()
download_unset_progress_cb()
typedef void(* download_state_changed_cb)(int download_id, download_state_e state, void *user_data)

Called when a download state is changed.

Since :
2.3
Parameters:
[in]download_idThe download ID
[in]stateThe state of download
[in]user_dataThe user data passed from download_set_state_changed_cb()
Precondition:
download_start() will invoke this callback if you register this callback using download_set_state_changed_cb().
See also:
download_set_state_changed_cb()
download_unset_state_changed_cb()

Enumeration Type Documentation

Enumeration for error codes of URL download.

Since :
2.3
Enumerator:
DOWNLOAD_ERROR_NONE 

Successful

DOWNLOAD_ERROR_INVALID_PARAMETER 

Invalid parameter

DOWNLOAD_ERROR_OUT_OF_MEMORY 

Out of memory

DOWNLOAD_ERROR_NETWORK_UNREACHABLE 

Network is unreachable

DOWNLOAD_ERROR_CONNECTION_TIMED_OUT 

HTTP session time-out

DOWNLOAD_ERROR_NO_SPACE 

No space left on device

DOWNLOAD_ERROR_PERMISSION_DENIED 

Permission denied

DOWNLOAD_ERROR_NOT_SUPPORTED 

Not supported

DOWNLOAD_ERROR_INVALID_STATE 

Invalid state

DOWNLOAD_ERROR_CONNECTION_FAILED 

Connection failed

DOWNLOAD_ERROR_INVALID_URL 

Invalid URL

DOWNLOAD_ERROR_INVALID_DESTINATION 

Invalid destination

DOWNLOAD_ERROR_TOO_MANY_DOWNLOADS 

Too many simultaneous downloads

DOWNLOAD_ERROR_QUEUE_FULL 

Download server queue is full

DOWNLOAD_ERROR_ALREADY_COMPLETED 

The download is already completed

DOWNLOAD_ERROR_FILE_ALREADY_EXISTS 

Failed to rename the downloaded file

DOWNLOAD_ERROR_CANNOT_RESUME 

Cannot resume

DOWNLOAD_ERROR_FIELD_NOT_FOUND 

Specified field not found

DOWNLOAD_ERROR_TOO_MANY_REDIRECTS 

Too many redirects from HTTP response header

DOWNLOAD_ERROR_UNHANDLED_HTTP_CODE 

The download cannot handle the HTTP status value

DOWNLOAD_ERROR_REQUEST_TIMEOUT 

No action after client creates a download ID

DOWNLOAD_ERROR_RESPONSE_TIMEOUT 

No call to start API for some time although the download is created

DOWNLOAD_ERROR_SYSTEM_DOWN 

No response from client after rebooting download daemon

DOWNLOAD_ERROR_ID_NOT_FOUND 

Download ID does not exist in download service module

DOWNLOAD_ERROR_INVALID_NETWORK_TYPE 

Network bonding is set but network type is not set as DOWNLOAD_NETWORK_ALL

DOWNLOAD_ERROR_NO_DATA 

No data because the set API is not called

DOWNLOAD_ERROR_IO_ERROR 

Internal I/O error

Enumeration for network type for downloading.

Since :
2.3
Enumerator:
DOWNLOAD_NETWORK_DATA_NETWORK 

Download is available through data network

DOWNLOAD_NETWORK_WIFI 

Download is available through WiFi

DOWNLOAD_NETWORK_WIFI_DIRECT 

Download is available through WiFi-Direct

DOWNLOAD_NETWORK_ALL 

Download is available through either data network or WiFi

Enumeration for the type of notification app control action which the client wants to set when registering notification.

Since :
2.3
See also:
download_set_notification_app_control()
download_get_notification_app_control()
Enumerator:
DOWNLOAD_NOTIFICATION_APP_CONTROL_TYPE_ONGOING 

App control action for failed and ongoing notification

DOWNLOAD_NOTIFICATION_APP_CONTROL_TYPE_COMPLETE 

App control action for completed notification

DOWNLOAD_NOTIFICATION_APP_CONTROL_TYPE_FAILED 

App control action for failed notification

Enumeration for notification types when a client wants to register.

Since :
2.3
See also:
download_set_notification_type()
download_get_notification_type()
Enumerator:
DOWNLOAD_NOTIFICATION_TYPE_NONE 

Do not register notification

DOWNLOAD_NOTIFICATION_TYPE_COMPLETE_ONLY 

Completion notification for success state and failed state

DOWNLOAD_NOTIFICATION_TYPE_ALL 

All download notifications for ongoing state, success state and failed state

Enumeration for download states.

Since :
2.3
Enumerator:
DOWNLOAD_STATE_NONE 

Unhandled exception

DOWNLOAD_STATE_READY 

Ready to download

DOWNLOAD_STATE_QUEUED 

Queued to start downloading

DOWNLOAD_STATE_DOWNLOADING 

Currently downloading

DOWNLOAD_STATE_PAUSED 

The download is waiting to resume

DOWNLOAD_STATE_COMPLETED 

The download is completed

DOWNLOAD_STATE_FAILED 

The download failed

DOWNLOAD_STATE_CANCELED 

User canceled the download item


Function Documentation

int download_add_http_header_field ( int  download_id,
const char *  field,
const char *  value 
)

Adds an HTTP header field to the download request.

This function allows the application to append custom headers to the download request, which can be used for authentication, content negotiation, or other HTTP operations. For more information, see HTTP/1.1: HTTP Message Headers.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
This function should be called before downloading (see download_start()).
It replaces any existing value for the given key.
It returns DOWNLOAD_ERROR_INVALID_PARAMETER if field or value is a zero-length string.
Parameters:
[in]download_idThe download ID
[in]fieldThe name of the HTTP header field
[in]valueThe value of the HTTP header field
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_OUT_OF_MEMORYOut of memory
DOWNLOAD_ERROR_INVALID_STATEInvalid state
DOWNLOAD_ERROR_IO_ERRORInternal I/O error
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Precondition:
The state must be DOWNLOAD_STATE_READY, DOWNLOAD_STATE_FAILED, or DOWNLOAD_STATE_CANCELED.
See also:
download_get_http_header_field()
download_remove_http_header_field()
int download_cancel ( int  download_id)

Cancels an active download, asynchronously.

This function cancels the running download and its state will be DOWNLOAD_STATE_READY.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
The canceled download can be restarted using download_start().
Parameters:
[in]download_idThe download ID
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_OUT_OF_MEMORYOut of memory
DOWNLOAD_ERROR_INVALID_STATEInvalid state
DOWNLOAD_ERROR_IO_ERRORInternal I/O error
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Precondition:
The download state must be DOWNLOAD_STATE_QUEUED, DOWNLOAD_STATE_DOWNLOADING, or DOWNLOAD_STATE_PAUSED.
Postcondition:
The download state will be DOWNLOAD_STATE_CANCELED.
See also:
download_start()
int download_create ( int *  download_id)

Initializes a new download request and returns download ID that can be used to control the download process.

download_id is the handle for managing download progress, pausing, resuming, or canceling downloads.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
The caller must release download_id using download_destroy(). Even if the device is off, download_id is available for 48 hours if the user does not call download_destroy().
Parameters:
[out]download_idThe download ID that is newly created on success
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_OUT_OF_MEMORYOut of memory
DOWNLOAD_ERROR_IO_ERRORInternal I/O error
DOWNLOAD_ERROR_QUEUE_FULLDownload server queue is full
Postcondition:
The download state will be DOWNLOAD_STATE_READY.
See also:
download_destroy()
int download_destroy ( int  download_id)

Frees the resources associated with a previously created download ID.

This function should be called when the download is completed or no longer needed to prevent memory leaks.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
After calling this function, the download_id is existed at DB in certain time. Within that time, it is able to use the other functions with the download_id. If DOWNLOAD_ERROR_ID_NOT_FOUND is returned, it means that the download_id is completely removed from DB.
Parameters:
[in]download_idThe download ID to be destroyed
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
See also:
download_create()
int download_get_auto_download ( int  download_id,
bool *  enable 
)

Gets whether the download is set to start automatically.

This function allows the application to check if the download has been configured to start automatically or if it requires manual initiation.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Parameters:
[in]download_idThe download ID
[out]enableA pointer to a boolean variable where the auto-download status will be stored
true if the download starts automatically, false if it requires manual initiation
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
See also:
download_set_auto_download()
int download_get_cache ( int  download_id,
bool *  enable 
)

Gets whether caching is enabled for the download.

This function allows the application to check if the download is set to use the cache.

Since :
8.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Parameters:
[in]download_idThe download id
[out]enableA pointer to a boolean variable that will store the cache setting * true to enable caching, false to disable it
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
DOWNLOAD_ERROR_IO_ERRORInternal I/O error
See also:
download_set_cache()
int download_get_content_name ( int  download_id,
char **  content_name 
)

Gets the content name of downloaded file.

This can be received when HTTP response header is received.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
The caller must release content_name using free().
Parameters:
[in]download_idThe download ID
[out]content_nameA pointer to store the retrieved content name
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Precondition:
The download state must be one of the states after DOWNLOAD_STATE_DOWNLOADING.
See also:
download_set_state_changed_cb()
download_unset_state_changed_cb()
download_start()
int download_get_content_size ( int  download_id,
unsigned long long *  content_size 
)

Gets the size of the content being downloaded.

This information is received from the server. If the server does not send the total size of the content, content_size is set to zero.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Parameters:
[in]download_idThe download ID
[out]content_sizeA pointer to store the size of the content in bytes.
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Precondition:
The download state must be one of the states after DOWNLOAD_STATE_DOWNLOADING.
See also:
download_set_state_changed_cb()
download_unset_state_changed_cb()
download_start()
int download_get_destination ( int  download_id,
char **  path 
)

Gets the file path where the downloaded content will be or has been saved.

This function allows the application to verify or retrieve the path where the downloaded file is stored.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
The caller must release path using free().
Parameters:
[in]download_idThe download ID
[out]pathA pointer to store the absolute path where the downloaded file is saved
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_OUT_OF_MEMORYOut of memory
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
See also:
download_set_destination()
int download_get_downloaded_file_path ( int  download_id,
char **  path 
)

Gets the absolute file path of the downloaded content.

This function returns the absolute file path where the downloaded content has been saved after the download has been completed.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
This function returns DOWNLOAD_ERROR_INVALID_STATE if the download is not completed. The caller must release path using free().
Parameters:
[in]download_idThe download ID
[out]pathA pointer to store the file path of the downloaded content
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_OUT_OF_MEMORYOut of memory
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Precondition:
The download state must be DOWNLOAD_STATE_COMPLETED.
See also:
download_set_file_name()
download_set_destination()
int download_get_error ( int  download_id,
download_error_e error 
)

Gets the last error that occurred during the download process.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Parameters:
[in]download_idThe download ID
[out]errorA pointer to store the error code associated with the download
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Precondition:
The download state must be DOWNLOAD_STATE_FAILED.
The download state must be DOWNLOAD_STATE_CANCELED.
See also:
download_set_state_changed_cb()
download_unset_state_changed_cb()
download_start()
download_error_e
int download_get_etag ( int  download_id,
char **  etag 
)

Gets the ETag (Entity Tag) from the server response for the download request when making a HTTP request for resume.

The ETag is a unique identifier assigned by the server to the content, which can be used to check for updates or changes to the file.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
The ETag is available or not depending on the web server.
After download is started, it can get the ETag.
The caller must release etag using free().
Parameters:
[in]download_idThe download ID
[out]etagA pointer to store the retrieved ETag
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
See also:
download_set_temp_file_path()
int download_get_file_name ( int  download_id,
char **  file_name 
)

Gets the name of the downloaded content previously set by download_set_file_name().

This function allows the application to check the file name that has been assigned for the download. If the name is not set, NULL is returned.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
The caller must release file_name using free().
Parameters:
[in]download_idThe download ID
[out]file_nameThe file name which is set by the application
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_OUT_OF_MEMORYOut of memory
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
See also:
download_set_file_name()
int download_get_http_header_field ( int  download_id,
const char *  field,
char **  value 
)

Gets the value of a specific HTTP header field that was added to the download request.

This function allows the application to query the value of an HTTP header field previously set using download_add_http_header_field().

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
This function returns DOWNLOAD_ERROR_INVALID_PARAMETER if field is zero-length string. The caller must release value using free().
Parameters:
[in]download_idThe download ID
[in]fieldThe name of the HTTP header field
[out]valueThe value associated with given field
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_OUT_OF_MEMORYOut of memory
DOWNLOAD_ERROR_INVALID_STATEInvalid state
DOWNLOAD_ERROR_FIELD_NOT_FOUNDSpecified field not found
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
See also:
download_add_http_header_field()
download_remove_http_header_field()
int download_get_http_header_field_list ( int  download_id,
char ***  fields,
int *  length 
)

Gets a list of all HTTP header fields that were added to the download request.

This function provides access to the names of all HTTP headers that were appended using download_add_http_header_field().

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
The caller must release fields using free().
Parameters:
[in]download_idThe download ID
[out]fieldsA pointer to a list that will contain the names of the HTTP header fields
[out]lengthThe number of the HTTP header fields
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_OUT_OF_MEMORYOut of memory
DOWNLOAD_ERROR_INVALID_STATEInvalid state
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
See also:
download_add_http_header_field()
download_remove_http_header_field()
int download_get_http_status ( int  download_id,
int *  HTTP_status 
)

Gets the HTTP status code when the download error occurs.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Parameters:
[in]download_idThe download ID
[out]HTTP_statusA pointer to store the retrieved HTTP status code defined in RFC 2616
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Precondition:
The download state must be DOWNLOAD_STATE_FAILED.
See also:
download_start()
int download_get_mime_type ( int  download_id,
char **  mime_type 
)

Gets the MIME type of the downloaded content.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
This function returns DOWNLOAD_ERROR_INVALID_STATE if the download has not been started. The caller must release mime_type using free().
Parameters:
[in]download_idThe download ID
[out]mime_typeThe MIME type of the downloaded file
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_OUT_OF_MEMORYOut of memory
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
See also:
download_set_file_name()
download_set_destination()
download_get_downloaded_file_path()
int download_get_network_type ( int  download_id,
download_network_type_e net_type 
)

Gets the current network type that is set for the download.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Parameters:
[in]download_idThe download ID
[out]net_typeThe network type that is defined by the user
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
See also:
download_set_network_type()
download_network_type_e

Gets the app control handle which is set by download_set_notification_app_control().

When the notification message is clicked, the action is decided by the app control handle.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
The caller must release handle using free().
Parameters:
[in]download_idThe download ID
[in]typeThe enumeration type
See download_notification_app_control_type_e.
[out]handleA pointer to store the retrieved app control handle
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
DOWNLOAD_ERROR_NO_DATAThe app control handle has not been set
 #include <download.h>
 #include <app_control.h>
 ...
 int ret = download_get_notification_app_control(id, DOWNLOAD_NOTIFICATION_APP_CONTROL_TYPE_COMPLETE, &handle);
 ...

 ret = app_control_destroy(handle);
See also:
download_set_notification_app_control()
int download_get_notification_description ( int  download_id,
char **  description 
)

Gets the description text that is set to be displayed in the download notification.

When registering a notification, the description is displayed in the description area of the notification message.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
The caller must release description using free().
Parameters:
[in]download_idThe download ID
[out]descriptionThe description for displaying to user
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
DOWNLOAD_ERROR_NO_DATAThe description has not been set
Precondition:
It can get the title value before calling this function.
See also:
download_set_notification_description()
int download_get_notification_title ( int  download_id,
char **  title 
)

Gets the title text that is set to be displayed in the download notification.

When registering a notification, the title is displayed in the title area of the notification message.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
The caller must release title using free().
Parameters:
[in]download_idThe download ID
[out]titleA pointer to store the retrieved title text
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
DOWNLOAD_ERROR_NO_DATAThe title has not been set
Precondition:
It can get the title value before calling this function.
See also:
download_set_notification_title()
int download_get_notification_type ( int  download_id,
download_notification_type_e type 
)

Gets the type of notification currently set for the download.

This function allows the application to check what type of notification is configured for the download process.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
When the notification message is clicked, the action is decided by the app control from download_set_notification_app_control().
The default type is DOWNLOAD_NOTIFICATION_TYPE_NONE.
Parameters:
[in]download_idThe download ID
[out]typeA pointer to store the retrieved notification type
See download_notification_type_e.
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
See also:
download_set_notification_type()
int download_get_state ( int  download_id,
download_state_e state 
)

Gets the current state of the download, such as whether it is in progress, paused, canceled, or completed.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Parameters:
[in]download_idThe download ID
[out]stateA pointer to store the retrieved state of the download
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
See also:
download_state_e
int download_get_temp_path ( int  download_id,
char **  temp_path 
)

Gets the temporary file path where the partially downloaded content is being stored.

This function provides access to the location where the file is saved during the download process before it is completed.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
The caller must release temp_path using free().
Parameters:
[in]download_idThe download ID
[out]temp_pathA pointer to store the retrieved temporary file path
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Precondition:
The download state must be one of the states after DOWNLOAD_STATE_DOWNLOADING.
See also:
download_set_state_changed_cb()
download_unset_state_changed_cb()
download_start()
int download_get_url ( int  download_id,
char **  url 
)

Gets the URL for the file to be downloaded.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
The caller must release url using free().
Parameters:
[in]download_idThe download ID
[out]urlThe URL to download
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_OUT_OF_MEMORYOut of memory
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
See also:
download_set_url()
int download_pause ( int  download_id)

Pauses an ongoing download asynchronously.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
The download can later be resumed using download_start() or canceled using download_cancel().
Parameters:
[in]download_idThe download ID
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_OUT_OF_MEMORYOut of memory
DOWNLOAD_ERROR_INVALID_STATEInvalid state
DOWNLOAD_ERROR_IO_ERRORInternal I/O error
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Precondition:
The download state must be DOWNLOAD_STATE_DOWNLOADING.
Postcondition:
The download state will be DOWNLOAD_STATE_PAUSED.
See also:
download_start()
download_cancel()
int download_remove_http_header_field ( int  download_id,
const char *  field 
)

Removes a specific HTTP header field from the download request.

This function allows the application to delete a previously added HTTP header.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
This function should be called before downloading (see download_start()). It returns DOWNLOAD_ERROR_INVALID_PARAMETER if the field is zero-length string.
Parameters:
[in]download_idThe download ID
[in]fieldThe name of the HTTP header field to remove
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_OUT_OF_MEMORYOut of memory
DOWNLOAD_ERROR_INVALID_STATEInvalid state
DOWNLOAD_ERROR_FIELD_NOT_FOUNDSpecified field not found
DOWNLOAD_ERROR_IO_ERRORInternal I/O error
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Precondition:
The state must be DOWNLOAD_STATE_READY, DOWNLOAD_STATE_FAILED, or DOWNLOAD_STATE_CANCELED.
See also:
download_add_http_header_field()
download_get_http_header_field()
int download_reset_cache ( void  )

Clears previously cached data.

Since :
8.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_TOO_MANY_DOWNLOADSToo many simultaneous downloads
DOWNLOAD_ERROR_IO_ERRORInternal I/O error
int download_set_auto_download ( int  download_id,
bool  enable 
)

Enables or disables automatic downloading of the file.

This function allows the application to control whether the download should start automatically after the download daemon is restarted, or if it should be manually triggered. The download progress continues after the application process is terminated.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
The default value is false.
Parameters:
[in]download_idThe download ID
[in]enableA boolean value indicating whether to enable automatic download
true to start automatically, false to require manual start
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Precondition:
The state must be DOWNLOAD_STATE_READY, DOWNLOAD_STATE_FAILED, or DOWNLOAD_STATE_CANCELED.
See also:
download_get_auto_download()
int download_set_cache ( int  download_id,
bool  enable 
)

Enables or disables the use of cache for the download.

This function allows the developer to control whether the downloaded content should be cached locally, reducing the need for re-downloading the same content in the future.

Since :
8.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Parameters:
[in]download_idThe download id
[in]enableA boolean value indicating whether to use the cache
true to enable caching, false to disable it
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
DOWNLOAD_ERROR_IO_ERRORInternal I/O error
See also:
download_get_cache()
int download_set_destination ( int  download_id,
const char *  path 
)

Sets the file path where the downloaded content will be saved on the device.

This function allows the application to define the location on the filesystem where the downloaded file should be stored. If the destination is not specified, the file will be downloaded to a default storage (see the Storage API).

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
This function should be called before downloading (see download_start()).
The mediastorage privilege http://tizen.org/privilege/mediastorage is needed if path is relevant to media storage.
The externalstorage privilege http://tizen.org/privilege/externalstorage is needed if path is relevant to external storage.
Parameters:
[in]download_idThe download ID
[in]pathThe absolute path where the downloaded file will be saved
If path is NULL, it clears the previous value.
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_OUT_OF_MEMORYOut of memory
DOWNLOAD_ERROR_INVALID_STATEInvalid state
DOWNLOAD_ERROR_INVALID_DESTINATIONInvalid destination
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Precondition:
The state must be DOWNLOAD_STATE_READY, DOWNLOAD_STATE_FAILED, or DOWNLOAD_STATE_CANCELED.
See also:
download_get_destination()
int download_set_file_name ( int  download_id,
const char *  file_name 
)

Sets the name to be used for the downloaded content.

This function allows the application to specify the file name for the content, independent of the URL or server-provided name.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
This function should be called before downloading (see download_start()).
Parameters:
[in]download_idThe download ID
[in]file_nameThe desired file name for the downloaded content.
If file_name is NULL it clears the previous value.
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_OUT_OF_MEMORYOut of memory
DOWNLOAD_ERROR_INVALID_STATEInvalid state
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Precondition:
The state must be DOWNLOAD_STATE_READY, DOWNLOAD_STATE_FAILED, or DOWNLOAD_STATE_CANCELED.
See also:
download_get_file_name()
int download_set_network_type ( int  download_id,
download_network_type_e  net_type 
)

Sets the type of network (e.g., Wi-Fi) that should be used for the download.

The file can be downloaded only under the allowed network.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
This function should be called before downloading (see download_start()).
Parameters:
[in]download_idThe download ID
[in]net_typeThe network type that the user prefers
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_INVALID_STATEInvalid state
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Precondition:
The state must be DOWNLOAD_STATE_READY, DOWNLOAD_STATE_FAILED, or DOWNLOAD_STATE_CANCELED.
See also:
download_get_network_type()
download_network_type_e

Sets an app control handle to register notification messages.

Three types of notification message can be posted: completion, failed and ongoing type.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
When the notification message is clicked, the action to take is decided by the app control handle.
If the app control handle is not set, the following default operation is executed when the notification message is clicked:
1) download completed state - the viewer application is executed according to extension name of downloaded content,
2) download failed state and ongoing state - the client application is executed.
This function should be called before starting the download.
The app control handle MUST BE FREED by the client when it is not used any more.
Parameters:
[in]download_idThe download ID
[in]typeThe enumeration type
See download_notification_app_control_type_e.
[in]handleThe app control handle pointer value
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Precondition:
The state must be DOWNLOAD_STATE_READY, DOWNLOAD_STATE_FAILED, or DOWNLOAD_STATE_CANCELED.
See also:
download_set_notification_type()
download_get_notification_app_control()
int download_set_notification_description ( int  download_id,
const char *  description 
)

Sets the description text to be displayed in the download notification.

When registering a notification, the description is displayed in the description area of the notification message.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Parameters:
[in]download_idThe download ID
[in]descriptionThe description text to display in the notification
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Precondition:
If the notification option is not enabled, this description is not shown to user.
See also:
download_set_notification_type()
download_get_notification_description()
int download_set_notification_title ( int  download_id,
const char *  title 
)

Sets the text to be displayed in the download notification.

When registering a notification, the title is displayed in the title area of the notification message.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Parameters:
[in]download_idThe download ID
[in]titleThe title text to display in the notification
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Precondition:
If a notification option is not enabled, this title is not shown to user.
See also:
download_set_notification_type()
download_get_notification_title()
int download_set_notification_type ( int  download_id,
download_notification_type_e  type 
)

Sets the type of notification to be displayed during the download process.

Three types of notification message can be posted: completion, failed and ongoing type.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
When the notification message is clicked, the action to take is decided by the app control handle (set by download_set_notification_app_control()).
If the app control is not set, the following default operation is executed when the notification message is clicked:
1) download completed state - the viewer application is executed according to extension name of downloaded content,
2) download failed state and ongoing state - the client application is executed.
The default type is DOWNLOAD_NOTIFICATION_TYPE_NONE.
This function should be called before starting the download.
Parameters:
[in]download_idThe download ID
[in]typeThe enumeration type
See download_notification_type_e.
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Precondition:
The state must be DOWNLOAD_STATE_READY, DOWNLOAD_STATE_FAILED, or DOWNLOAD_STATE_CANCELED.
See also:
download_set_notification_app_control()
download_get_notification_type()
int download_set_progress_cb ( int  download_id,
download_progress_cb  callback,
void *  user_data 
)

Sets a callback function to be called to track the progress of the download.

This function allows the application to monitor the progress of the download in real time, typically used to update the UI with the current download percentage.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
This function should be called before downloading (see download_start()).
Parameters:
[in]download_idThe download ID
[in]callbackThe callback function to be invoked as the download progresses
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_INVALID_STATEInvalid state
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Postcondition:
download_progress_cb() will be invoked.
See also:
download_unset_progress_cb()
download_progress_cb()
int download_set_state_changed_cb ( int  download_id,
download_state_changed_cb  callback,
void *  user_data 
)

Sets a callback function to be called when the download state changes.

This function allows the application to register a callback that is triggered when the download's state changes, such as when the download starts, pauses, completes, or fails.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
This function should be called before downloading (see download_start()).
Parameters:
[in]download_idThe download ID
[in]callbackThe callback function to be invoked when the download state changes
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Postcondition:
download_state_changed_cb() will be invoked.
See also:
download_unset_state_changed_cb()
download_state_changed_cb()
int download_set_temp_file_path ( int  download_id,
char *  path 
)

Sets the temporary file path used in the previous download request.

This is only useful when resuming download to make HTTP request header at the application side. Otherwise, the path should be ignored internally.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
If the etag value is not present in the download database, it is useless to set the temporary path.
When resuming download, the data is attached at the end of this temporary file.
The mediastorage privilege http://tizen.org/privilege/mediastorage is needed if path is relevant to media storage.
The externalstorage privilege http://tizen.org/privilege/externalstorage is needed if path is relevant to external storage.
Parameters:
[in]download_idThe download ID
[out]pathThe path where the temporary file will be stored
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_INVALID_DESTINATIONInvalid destination
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Precondition:
The state must be DOWNLOAD_STATE_READY, DOWNLOAD_STATE_FAILED, or DOWNLOAD_STATE_CANCELED.
See also:
download_get_etag()
int download_set_url ( int  download_id,
const char *  url 
)

Sets the URL for the file to be downloaded.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
This function should be called before downloading (see download_start()).
Parameters:
[in]download_idThe download ID
[in]urlThe URL to download
If url is NULL, it clears the previous value.
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_OUT_OF_MEMORYOut of memory
DOWNLOAD_ERROR_INVALID_STATEInvalid state
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
Precondition:
The state must be DOWNLOAD_STATE_READY, DOWNLOAD_STATE_FAILED, or DOWNLOAD_STATE_CANCELED.
See also:
download_get_url()
int download_start ( int  download_id)

Starts or resumes the download process asynchronously for the given download ID.

This function starts to download the specified URL, or resumes the download if paused.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
The URL is the mandatory information to start the download.
The application should call download_set_progress_cb() and download_set_state_changed_cb() again after the application process is restarted or download_destroy() is called.
Parameters:
[in]download_idThe download ID
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_OUT_OF_MEMORYOut of memory
DOWNLOAD_ERROR_INVALID_STATEInvalid state
DOWNLOAD_ERROR_IO_ERRORInternal I/O error
DOWNLOAD_ERROR_INVALID_URLInvalid URL
DOWNLOAD_ERROR_INVALID_DESTINATIONInvalid destination
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
DOWNLOAD_ERROR_QUEUE_FULLDownload server queue is full
Precondition:
The download state must be DOWNLOAD_STATE_READY, DOWNLOAD_STATE_PAUSED, DOWNLOAD_STATE_CANCELED, or DOWNLOAD_STATE_FAILED.
Postcondition:
The download state will be DOWNLOAD_STATE_QUEUED or DOWNLOAD_STATE_DOWNLOADING.
See also:
download_set_url()
download_pause()
download_cancel()
int download_unset_progress_cb ( int  download_id)

Unsets the callback function for the download progress.

This function removes the previously set progress callback, so no further notifications about download progress will be received.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
This function should be called before downloading (see download_start()).
Parameters:
[in]download_idThe download ID
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_INVALID_STATEInvalid state
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
See also:
download_set_progress_cb()
download_progress_cb()
int download_unset_state_changed_cb ( int  download_id)

Unsets the callback function for the download state changes.

This function removes the previously set callback for state changes, ensuring that no callback is invoked when the download's state changes.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/download
Remarks:
This function should be called before downloading (see download_start()).
Parameters:
[in]download_idThe download ID
Returns:
0 on success, otherwise a negative error value
Return values:
DOWNLOAD_ERROR_NONESuccessful
DOWNLOAD_ERROR_NOT_SUPPORTEDNot supported
DOWNLOAD_ERROR_PERMISSION_DENIEDPermission denied
DOWNLOAD_ERROR_INVALID_PARAMETERInvalid parameter
DOWNLOAD_ERROR_ID_NOT_FOUNDNo download ID
See also:
download_set_state_changed_cb()
download_state_changed_cb()