[TIMOB-18854] iOS: Apple Watch support to the open the iOS app in the background via openParentApplication
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | High |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2015-08-19T08:29:04.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Rick Blalock |
Assignee | Eric Merriman |
Created | 2015-04-25T02:33:48.000+0000 |
Updated | 2017-03-23T22:29:53.000+0000 |
Description
In order for the watch to get certain things from the iOS app, the handleWatchKitExtensionRequest method in the app delegate needs to be implemented. I imagine this could be a system wide event in Ti similar to the resume event.
https://developer.apple.com/library/ios/documentation/WatchKit/Reference/WKInterfaceController_class/#//apple_ref/occ/clm/WKInterfaceController/openParentApplication:reply:
Some other links:
https://www.bignerdranch.com/blog/watchKit-extensions-communicating-with-your-parent-application/
http://www.kristinathai.com/send-data-to-parent-ios-app/
Ref. this https://gist.github.com/benbahrenburg/7812ae9259b8e06fff10 https://github.com/appcelerator/titanium_mobile/pull/6803
Ben's gist above works fine but the caveat is you have to have the iOS app open in order for it to work. The reason is according to these docs: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/#//apple_ref/occ/intfm/UIApplicationDelegate/application:handleWatchKitExtensionRequest:reply "Because this method is likely to be called while your app is in the background, call the beginBackgroundTaskWithName:expirationHandler: method at the start of your implementation and the endBackgroundTask: method after you have processed the reply and executed the reply block. Starting a background task ensures that your app is not suspended before it has a chance to send its reply." This will need to be implemented as well in order to give a Ti app time to boot.
This will be placed out of sprint at the moment in favour of watch connectivity for watch OS2, and Release 4.3.0.
As Apple is gearing us towards watchOS2 and watchConnectivity, closing this as it is support for watchkit 1.
Closing ticket as Won't Fix with reference to the above comments.