Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19004] iOS9: Support Watch Connectivity

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-08-15T09:55:41.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.0.0
ComponentsiOS
LabelsIOS9, watchkit
ReporterBen Bahrenburg
AssigneeEric Merriman
Created2015-06-11T21:43:38.000+0000
Updated2017-03-21T19:27:24.000+0000

Description

Support Watch Connectivity, so that a watchOS2 app can communication with a Titanium application. Below is the pre-release documentation on this framework: https://developer.apple.com/library/prerelease/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS9.html#//apple_ref/doc/uid/TP40016198-DontLinkElementID_1 https://developer.apple.com/library/prerelease/ios/documentation/WatchConnectivity/Reference/WCSession_class/index.html#//apple_ref/doc/uid/TP40015237 Sample code: https://developer.apple.com/library/prerelease/ios/samplecode/Lister/Introduction/Intro.html#//apple_ref/doc/uid/TP40014701

Comments

  1. Ben Bahrenburg 2015-06-25

    Spoke with the Apple engineers about the best way to implement while at WWDC. Their recommendations in the context of the kind of app structure Ti is composted as: 1. Create a singleton in TiApp.m 2. Create the singleton in didFinishLaunchingWithOptions. In the case of Ti, we will need to make sure the app is booted For #2, I would recommend requiring in an external class containing the WCSessionDelegate methods for the singleton. The biggest engineering problem will be to make sure Ti has booted, otherwise the events will not be raised to JS. This most likely will require the delegate receiving methods being wrapped in a backgroundTask.
  2. Chee Kiat Ng 2015-08-15

    PR Here: https://github.com/appcelerator/titanium_mobile/pull/7028 Titanium test project here: https://github.com/cheekiatng/Titanium-WatchOS2-Sample-App

    Steps to test

    1. in project directory of demo app, *ti build -p ios -I 9.0 --launch-watch-app* 2. Click status me. 3. Send message from phone app when watch app is in foreground 4. Send app context from phone app when watch app is in background 5. Send user info from phone app when watch app is in background 6. Send file from phone app when watch app is in background 7. Repeat steps 4 - 6 when watch app is in foreground. 8. Repeat steps 3 - 7, but this time, from the watch app to the phone app. 9. Delete watch app

    Expected Result

    2. *isWatchAppInstalled = true, isReachable = true, isPaired = true, isComplicationEnabled = false* 3. message seen on watch app 4. Bring watch app to foreground to verify that app context is shown on watch app 5. Bring watch app to foreground to verify that user info is shown on watch app. Phone app would also trigger event that user info is sent. (watchSessionFinishedUserInfoTransfer) 6. Bring watch app to foreground to verify that an image is shown on watch app. Phone app would also trigger event that file is sent. (watchSessionFinishedFileTransfer) 7. Expected to see the same results as 4 - 6 8. Expected same outcome as watch app on phone app 9. Event "watchStateChanged" triggered *Note*: Also expect to see event "watchReachabilityChanged" triggered when watch app transits between foreground and background.
  3. Chee Kiat Ng 2015-08-15

    PR Merged.
  4. Chee Kiat Ng 2015-08-15

    *Note:* To create a watch OS 2 and titanium Project, follow these steps: 1. Create a new project: ti create --type app --name foo --id com.appc.foo --platforms all --url http://foo --workspace-dir . 2. cd into the project: cd foo 3. Add a WatchKit 2 app: ti create --type applewatch --name bar --template watchos2 4. Build the app: ti build -p ios -I 9.0 --launch-watch-app
  5. Chee Kiat Ng 2015-08-25

    PR here for parameter change and addition of activate method: https://github.com/appcelerator/titanium_mobile/pull/7067 PR Merged.
  6. Lee Morris 2017-03-21

    Closing ticket as fixed.

JSON Source