Wrapper to support iOS's NSURLSession class for background downloads.
Requires: iOS 7.0.0 and later
These APIs are supported on iOS 7 and later.
The URL session module (com.appcelerator.urlSession
) provides the application the ability to
download large content via HTTP while the application is in the background. With this module, you can
URL session events are monitored through the following iOS application-level events:
These events are monitored as application-level events by using the addEventListener
method with the
Titanium.App.iOS namespace.
For more information on getting started, refer to the iOS Background Services guide.
The name of the API that this proxy corresponds to.
The name of the API that this proxy corresponds to.
The value of this property is the fully qualified name of the API. For example, Button
returns Ti.UI.Button
.
The configuration used for this url session.
The configuration used for this url session.
Configuration options for an Modules.URLSession.Session object.
When a session is created, a copy of the configuration object is made.
you cannot modify the configuration of a session after it has been created.
The shared session uses the global singleton credential, cache and cookie storage objects.
An ephemeral session has no persistent disk storage for cookies, cache or credentials.
A background session can be used to perform networking operations on behalf of a suspended application, within certain constraints.
The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.
The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.
If this property is set to a Window or TabGroup, then the corresponding Activity lifecycle event callbacks will also be called on the proxy. Proxies that require the activity lifecycle will need this property set to the appropriate containing Window or TabGroup.
Applies the properties to the proxy.
Properties are supplied as a dictionary. Each key-value pair in the object is applied to the proxy such that myproxy[key] = value.
A dictionary of properties to apply.
Creates a download task for the specified URL, within the provided session object and saves the results to a file.
deprecated since 6.1.0
Use <Modules.URLSession.Session.downloadTask> on the session directly.
Once this function is called, the download starts automatically. The progress of
the download can be monitored by listening to the downloadprogress
, downloadcompleted
,
sessioneventscompleted
and sessioncompleted
events.
URL session object.
URL to download content from.
Task's identifier number.
Invalidates the given session object, allowing any outstanding tasks to finish.
deprecated since 6.1.0
Use <Modules.URLSession.Session.finishTasksAndInvalidate> (on the session object) instead.
This method returns immediately without waiting for tasks to finish. Once a session is invalidated,
new tasks cannot be created in the session, but existing tasks continue until completion. Once
invalidated, references to the events and callback objects are broken. Session objects cannot be
reused. To cancel all outstanding tasks, call invalidateAndCancel
instead.
URL session object.
Cancels all outstanding tasks and then invalidates the session object.
deprecated since 6.1.0
Use <Modules.URLSession.Session.invalidateAndCancel> (on the session object) instead.
Once invalidated, references to the events and callback objects are broken. Session objects cannot
be reused. To allow outstanding tasks to run until completion, call
finishTasksAndInvalidate
instead.
URL session object.
Sets the value of the configuration property.
New value for the property.
Sets the value of the lifecycleContainer property.
New value for the property.