Titanium.WatchSession
> Titanium.WatchSession

Used to enable data and file transfers between a watchOS and iOS application.

WatchSession enables data and file transfers between a WatchKit application and a Titanium application using the iOS Watch Connectivity framework introduced in iOS 9 and watchOS 2.

  • 5.0.0
Defined By

Properties

Titanium.WatchSession
: Numberreadonly
The watch is currently activated. ...

The watch is currently activated.

Requires: iOS 9.3 and later

  • 5.4.0
Titanium.WatchSession
: Numberreadonly
The watch is currently inactive. ...

The watch is currently inactive.

Requires: iOS 9.3 and later

  • 5.4.0
Titanium.WatchSession
: Numberreadonly
The watch is currently not activated. ...

The watch is currently not activated.

Requires: iOS 9.3 and later

  • 5.4.0
Titanium.WatchSession
: Numberreadonly
Returns the current activation state of the watch. ...

Returns the current activation state of the watch.

Requires: iOS 9.3 and later

This API can be assigned the following constants:

  • 5.4.0
apiName : Stringreadonly

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.

  • 3.2.0
  • 3.2.0
  • 3.2.0
Indicates if the proxy will bubble an event to its parent. ...

Indicates if the proxy will bubble an event to its parent.

Some proxies (most commonly views) have a relationship to other proxies, often established by the add() method. For example, for a button added to a window, a click event on the button would bubble up to the window. Other common parents are table sections to their rows, table views to their sections, and scrollable views to their views. Set this property to false to disable the bubbling to the proxy's parent.

Default: true

  • 3.0.0
  • 3.0.0
  • 3.0.0
Titanium.WatchSession
: Booleanreadonly
Returns true if there is more content for the session to deliver. ...

Returns true if there is more content for the session to deliver.

Requires: iOS 10.0 and later

  • 6.0.0
Titanium.WatchSession
: Booleanreadonly
Returns true if the watch is currently activated. ...

Returns true if the watch is currently activated.

Requires: iOS 9.3 and later

  • 5.4.0
Titanium.WatchSession
: Booleanreadonly
Returns true if complication is enabled on the installed watch app. ...

Returns true if complication is enabled on the installed watch app.

Requires: iOS 9.0 and later

Titanium.WatchSession
: Booleanreadonly
Returns true if the device is paired with a watch. ...

Returns true if the device is paired with a watch.

Requires: iOS 9.0 and later

Titanium.WatchSession
: Booleanreadonly
Returns true if the watch is currently reachable. ...

Returns true if the watch is currently reachable.

Requires: iOS 9.0 and later

Titanium.WatchSession
: Booleanreadonly
Returns true if the device supports watch connectivity. ...

Returns true if the device supports watch connectivity.

Requires: iOS 9.0 and later

Titanium.WatchSession
: Booleanreadonly
Returns true if the accompanying watch app is installed. ...

Returns true if the accompanying watch app is installed.

Requires: iOS 9.0 and later

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.

  • 3.6.0
Titanium.WatchSession
: Dictionaryreadonly
The most recent application context sent to the watch app. ...

The most recent application context sent to the watch app.

Requires: iOS 9.0 and later

Titanium.WatchSession
: Numberreadonly
The number of calls remaining to transferCurrentComplication before the system starts transferring the complicationU...

The number of calls remaining to transferCurrentComplication before the system starts transferring the complicationUserInfo as regular userInfos.

Requires: iOS 10.0 and later

Default: 0

  • 6.0.0
Defined By

Methods

Titanium.WatchSession
( )
Activates the watch session Requires: iOS 9.0 and later ...

Activates the watch session

Requires: iOS 9.0 and later

Activates the watch session to make the app ready to receive messages from the watch app.

Returns

  • void
Adds the specified callback as an event listener for the named event. ...

Adds the specified callback as an event listener for the named event.

Parameters

  • name : String

    Name of the event.

  • callback : Callback<Object>

    Callback function to invoke when the event is fired.

Returns

  • void
Applies the properties to the proxy. ...

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.

  • 3.0.0
  • 3.0.0
  • 3.0.0

Parameters

  • props : Dictionary

    A dictionary of properties to apply.

Returns

  • void
Titanium.WatchSession
( )
Cancels all incomplete file transfers to the apple watch. ...

Cancels all incomplete file transfers to the apple watch.

Requires: iOS 9.0 and later

Cancels all incomplete file transfers to the apple watch.

Returns

  • void
Titanium.WatchSession
( )
Cancels all incomplete transfers to the apple watch. ...

Cancels all incomplete transfers to the apple watch.

Requires: iOS 9.0 and later

Cancels all incomplete transfers to the apple watch, including user info, complication and file.

Returns

  • void
Titanium.WatchSession
( )
Cancels all incomplete user info and complication transfers to the apple watch. ...

Cancels all incomplete user info and complication transfers to the apple watch.

Requires: iOS 9.0 and later

Cancels all incomplete user info and complication transfers to the apple watch.

Returns

  • void
Fires a synthesized event to any registered listeners. ...

Fires a synthesized event to any registered listeners.

Parameters

  • name : String

    Name of the event.

  • event : Dictionary

    A dictionary of keys and values to add to the Titanium.Event object sent to the listeners.

Returns

  • void
Titanium.WatchSession
( ) : Number
Gets the value of the activationState property. ...

Gets the value of the activationState property.

  • 5.4.0

Returns

  • Number
Gets the value of the apiName property. ...

Gets the value of the apiName property.

  • 3.2.0
  • 3.2.0
  • 3.2.0

Returns

  • String
Gets the value of the bubbleParent property. ...

Gets the value of the bubbleParent property.

  • 3.0.0
  • 3.0.0
  • 3.0.0

Returns

  • Boolean
Titanium.WatchSession
( ) : Boolean
Gets the value of the hasContentPending property. ...

Gets the value of the hasContentPending property.

  • 6.0.0

Returns

  • Boolean
Titanium.WatchSession
( ) : Boolean
Gets the value of the isActivated property. ...

Gets the value of the isActivated property.

  • 5.4.0

Returns

  • Boolean
Titanium.WatchSession
( ) : Boolean
Gets the value of the isComplicationEnabled property. ...

Gets the value of the isComplicationEnabled property.

Returns

  • Boolean
Titanium.WatchSession
( ) : Boolean
Gets the value of the isPaired property. ...

Gets the value of the isPaired property.

Returns

  • Boolean
Titanium.WatchSession
( ) : Boolean
Gets the value of the isReachable property. ...

Gets the value of the isReachable property.

Returns

  • Boolean
Titanium.WatchSession
( ) : Boolean
Gets the value of the isSupported property. ...

Gets the value of the isSupported property.

Returns

  • Boolean
Titanium.WatchSession
( ) : Boolean
Gets the value of the isWatchAppInstalled property. ...

Gets the value of the isWatchAppInstalled property.

Returns

  • Boolean
Gets the value of the lifecycleContainer property. ...

Gets the value of the lifecycleContainer property.

  • 3.6.0

Returns

Titanium.WatchSession
( ) : Dictionary
Gets the value of the recentApplicationContext property. ...

Gets the value of the recentApplicationContext property.

Returns

Titanium.WatchSession
( ) : Number
Gets the value of the remainingComplicationUserInfoTransfers property. ...

Gets the value of the remainingComplicationUserInfoTransfers property.

  • 6.0.0

Returns

  • Number
Removes the specified callback as an event listener for the named event. ...

Removes the specified callback as an event listener for the named event.

Multiple listeners can be registered for the same event, so the callback parameter is used to determine which listener to remove.

When adding a listener, you must save a reference to the callback function in order to remove the listener later:

var listener = function() { Ti.API.info("Event listener called."); }
window.addEventListener('click', listener);

To remove the listener, pass in a reference to the callback function:

window.removeEventListener('click', listener);

Parameters

  • name : String

    Name of the event.

  • callback : Callback<Object>

    Callback function to remove. Must be the same function passed to addEventListener.

Returns

  • void
Titanium.WatchSession
( message, [reply] )
Sends a message to the apple watch. ...

Sends a message to the apple watch.

Requires: iOS 9.0 and later

Sends a message to the installed watchapp on the apple watch in the foreground.

Parameters

  • message : Dictionary

    Message to send to apple watch. This property is required and the key of the dictionary needs to be a String.

  • reply : Callback<MessageReply> (optional)

    Function to be called upon receiving a reply from the watch app.

    Since Release 5.1.0

    This function is used to process the direct reply from the watch app after sending one.

Returns

  • void
Sets the value of the bubbleParent property. ...

Sets the value of the bubbleParent property.

  • 3.0.0
  • 3.0.0
  • 3.0.0

Parameters

  • bubbleParent : Boolean

    New value for the property.

Returns

  • void
Sets the value of the lifecycleContainer property. ...

Sets the value of the lifecycleContainer property.

  • 3.6.0

Parameters

Returns

  • void
Titanium.WatchSession
( params )
Transfers complication data to the watch application. ...

Transfers complication data to the watch application.

Requires: iOS 9.0 and later

Transfers complication data to the installed watch app. This is only for watch apps with complications enabled.

Parameters

  • params : Dictionary

    Complication to be transferred to watch app.

Returns

  • void
Titanium.WatchSession
( params )
Transfers a file to the apple watch. ...

Transfers a file to the apple watch.

Requires: iOS 9.0 and later

Transfers a file to the installed watchapp on the apple watch in the background. Subsequent transfers are queued.

Parameters

  • params : Dictionary

    Pass an object with the following key-value pairs:

    • fileURL (String) (required): Local filesystem path of file to send to the watch app.
    • metaData (Dictionary) (optional): Additional information about the file to send to the watch app.

Returns

  • void
Titanium.WatchSession
( params )
Transfers an user info to the apple watch. ...

Transfers an user info to the apple watch.

Requires: iOS 9.0 and later

Transfers an user info object to the installed watchapp on the apple watch in the background. Subsequent transfers are queued.

Parameters

  • params : Dictionary

    userInfo to be transferred to apple watch.

Returns

  • void
Titanium.WatchSession
( params )
Sends an app context update to the apple watch. ...

Sends an app context update to the apple watch.

Requires: iOS 9.0 and later

Sends an app context update to the apple watch. If watchapp is in background during transfer, watchapp will fire the receiveapplicationcontext event immediately when it becomes active. Only one app context is stored at any one time. Subsequent updates will simply replace the earlier one sent.

Parameters

  • params : Dictionary

    App context to be updated in apple watch.

Returns

  • void
Defined By

Events

Titanium.WatchSession
Called when the session has completed activation. ...

Called when the session has completed activation. If session state is ACTIVATION_STATE_NOT_ACTIVATED there will be an error with more details.

Requires: iOS 9.3 and later

  • 5.4.0

Properties

  • isPaired : Boolean

    If the device is paired with the apple watch.

    •  
  • isReachable : Boolean

    If apple watch is currently reachable.

    •  
  • isWatchAppInstalled : Boolean

    If the watch app is installed in the apple watch.

    •  
  • isComplicationEnabled : Boolean

    If the complication is enabled in the apple watch.

    •  
  • isActivated : Boolean

    If the apple watch is currently activated. Only available on iOS 9.3 and later. See for more infos.

    •  
  • activationState : Number

    Returns the current activation state of the watch. Only available on iOS 9.3 and later. See for more infos.

    This API can be assigned the following constants:

    •  
  • source : Object

    Source object that fired the event.

    •  
    •  
    •  
  • type : String

    Name of the event fired.

    •  
    •  
    •  
  • bubbles : Boolean

    True if the event will try to bubble up if possible.

    •  
    •  
    •  
  • cancelBubble : Boolean

    Set to true to stop the event from bubbling.

    •  
    •  
    •  
Titanium.WatchSession
Called when all events for the previously selected watch has occurred. ...

Called when all events for the previously selected watch has occurred. The session can be re-activated for the now selected watch using activateSession.

Requires: iOS 9.3 and later

  • 5.4.0

Properties

  • isPaired : Boolean

    If the device is paired with the apple watch.

    •  
  • isReachable : Boolean

    If apple watch is currently reachable.

    •  
  • isWatchAppInstalled : Boolean

    If the watch app is installed in the apple watch.

    •  
  • isComplicationEnabled : Boolean

    If the complication is enabled in the apple watch.

    •  
  • isActivated : Boolean

    If the apple watch is currently activated. Only available on iOS 9.3 and later. See for more infos.

    •  
  • hasContentPending : Boolean

    If the apple watch has currently content pending. Only available on iOS 10.0 and later. See for more infos.

    •  
  • remainingComplicationUserInfoTransfers : Boolean

    If the apple watch has complication userInfo transfers left. Only available on iOS 10.0 and later. See for more infos.

    •  
  • activationState : Number

    Returns the current activation state of the watch. Only available on iOS 9.3 and later. See for more infos.

    This API can be assigned the following constants:

    •  
  • source : Object

    Source object that fired the event.

    •  
    •  
    •  
  • type : String

    Name of the event fired.

    •  
    •  
    •  
  • bubbles : Boolean

    True if the event will try to bubble up if possible.

    •  
    •  
    •  
  • cancelBubble : Boolean

    Set to true to stop the event from bubbling.

    •  
    •  
    •  
Titanium.WatchSession
App completed file transfer to watch app. ...

App completed file transfer to watch app.

Properties

  • fileURL : String

    URL of the file transferred.

    •  
  • metaData : Dictionary

    meta data of the file transferred.

    •  
  • success : Boolean

    If the transfer was successful.

    •  
  • errorCode : Number

    Error code if transfer failed.

    •  
  • message : String

    Error message if any.

    •  
  • source : Object

    Source object that fired the event.

    •  
    •  
    •  
  • type : String

    Name of the event fired.

    •  
    •  
    •  
  • bubbles : Boolean

    True if the event will try to bubble up if possible.

    •  
    •  
    •  
  • cancelBubble : Boolean

    Set to true to stop the event from bubbling.

    •  
    •  
    •  
Titanium.WatchSession
Fired when the application completed user info transfer to the watch app. ...

Fired when the application completed user info transfer to the watch app.

Properties

  • userInfo : Dictionary

    The downloaded data as a Titanium.Blob object.

    •  
  • success : Boolean

    If the transfer was successful.

    •  
  • errorCode : Number

    Error code if transfer failed.

    •  
  • message : String

    Error message if any.

    •  
  • source : Object

    Source object that fired the event.

    •  
    •  
    •  
  • type : String

    Name of the event fired.

    •  
    •  
    •  
  • bubbles : Boolean

    True if the event will try to bubble up if possible.

    •  
    •  
    •  
  • cancelBubble : Boolean

    Set to true to stop the event from bubbling.

    •  
    •  
    •  
Titanium.WatchSession
Called when the session can no longer be used to modify or add any new transfers and, all interactive messages will ...

Called when the session can no longer be used to modify or add any new transfers and, all interactive messages will be cancelled, but events for background transfers can still fire. This will happen when the selected watch is being changed.

Requires: iOS 9.3 and later

  • 5.4.0

Properties

  • isPaired : Boolean

    If the device is paired with the apple watch.

    •  
  • isReachable : Boolean

    If apple watch is currently reachable.

    •  
  • isWatchAppInstalled : Boolean

    If the watch app is installed in the apple watch.

    •  
  • isComplicationEnabled : Boolean

    If the complication is enabled in the apple watch.

    •  
  • isActivated : Boolean

    If the apple watch is currently activated. Only available on iOS 9.3 and later. See for more infos.

    •  
  • activationState : Number

    Returns the current activation state of the watch. Only available on iOS 9.3 and later. See for more infos.

    This API can be assigned the following constants:

    •  
  • source : Object

    Source object that fired the event.

    •  
    •  
    •  
  • type : String

    Name of the event fired.

    •  
    •  
    •  
  • bubbles : Boolean

    True if the event will try to bubble up if possible.

    •  
    •  
    •  
  • cancelBubble : Boolean

    Set to true to stop the event from bubbling.

    •  
    •  
    •  
Titanium.WatchSession
The watch reachability state has changed. ...

The watch reachability state has changed.

Properties

  • isPaired : Boolean

    If the device is paired with the apple watch.

    •  
  • isReachable : Boolean

    If apple watch is currently reachable.

    •  
  • isWatchAppInstalled : Boolean

    If the watch app is installed in the apple watch.

    •  
  • isComplicationEnabled : Boolean

    If the complication is enabled in the apple watch.

    •  
  • isActivated : Boolean

    If the apple watch is currently activated. Only available on iOS 9.3 and later. See for more infos.

    •  
  • activationState : Number

    Returns the current activation state of the watch. Only available on iOS 9.3 and later. See for more infos.

    This API can be assigned the following constants:

    •  
  • source : Object

    Source object that fired the event.

    •  
    •  
    •  
  • type : String

    Name of the event fired.

    •  
    •  
    •  
  • bubbles : Boolean

    True if the event will try to bubble up if possible.

    •  
    •  
    •  
  • cancelBubble : Boolean

    Set to true to stop the event from bubbling.

    •  
    •  
    •  
Titanium.WatchSession
App received app context from apple watch. ...

App received app context from apple watch. Will be called on startup if an applicationContext is available.

Properties

  • applicationContext : Dictionary

    The application Context

    •  
  • source : Object

    Source object that fired the event.

    •  
    •  
    •  
  • type : String

    Name of the event fired.

    •  
    •  
    •  
  • bubbles : Boolean

    True if the event will try to bubble up if possible.

    •  
    •  
    •  
  • cancelBubble : Boolean

    Set to true to stop the event from bubbling.

    •  
    •  
    •  
Titanium.WatchSession
App received file from apple watch in background. ...

App received file from apple watch in background.

Properties

  • data : Titanium.Blob

    The downloaded data as a Titanium.Blob object.

    •  
  • metaData : Dictionary

    Information about the file.

    •  
  • success : Boolean

    If the transfer was successful.

    •  
  • errorCode : Number

    Error code if transfer failed.

    •  
  • message : String

    Error message if any.

    •  
  • source : Object

    Source object that fired the event.

    •  
    •  
    •  
  • type : String

    Name of the event fired.

    •  
    •  
    •  
  • bubbles : Boolean

    True if the event will try to bubble up if possible.

    •  
    •  
    •  
  • cancelBubble : Boolean

    Set to true to stop the event from bubbling.

    •  
    •  
    •  
Titanium.WatchSession
App received message from apple watch in foreground. ...

App received message from apple watch in foreground. Will be called on startup if the incoming message caused the receiver to launch.

Properties

  • message : Dictionary

    The message content

    •  
  • source : Object

    Source object that fired the event.

    •  
    •  
    •  
  • type : String

    Name of the event fired.

    •  
    •  
    •  
  • bubbles : Boolean

    True if the event will try to bubble up if possible.

    •  
    •  
    •  
  • cancelBubble : Boolean

    Set to true to stop the event from bubbling.

    •  
    •  
    •  
Titanium.WatchSession
App received user info from apple watch in background. ...

App received user info from apple watch in background. Will be called on startup if the user info finished transferring when the receiver was not running.

Properties

  • userInfo : Dictionary

    The user info content

    •  
  • source : Object

    Source object that fired the event.

    •  
    •  
    •  
  • type : String

    Name of the event fired.

    •  
    •  
    •  
  • bubbles : Boolean

    True if the event will try to bubble up if possible.

    •  
    •  
    •  
  • cancelBubble : Boolean

    Set to true to stop the event from bubbling.

    •  
    •  
    •  
Titanium.WatchSession
The watch state has changed. ...

The watch state has changed.

Properties

  • isPaired : Boolean

    If the device is paired with the apple watch.

    •  
  • isReachable : Boolean

    If apple watch is currently reachable.

    •  
  • isWatchAppInstalled : Boolean

    If the watch app is installed in the apple watch.

    •  
  • isComplicationEnabled : Boolean

    If the complication is enabled in the apple watch.

    •  
  • isActivated : Boolean

    If the apple watch is currently activated. Only available on iOS 9.3 and later. See for more infos.

    •  
  • activationState : Number

    Returns the current activation state of the watch. Only available on iOS 9.3 and later. See for more infos.

    This API can be assigned the following constants:

    •  
  • source : Object

    Source object that fired the event.

    •  
    •  
    •  
  • type : String

    Name of the event fired.

    •  
    •  
    •  
  • bubbles : Boolean

    True if the event will try to bubble up if possible.

    •  
    •  
    •  
  • cancelBubble : Boolean

    Set to true to stop the event from bubbling.

    •  
    •  
    •