WatchKit: Handoff from Long Look? - ios

Is it possible to use Handoff in Long Look from Apple Watch to iPhone? The use case would be like this:
User receives a push notification on his Apple Watch.
By raising the Watch he gets more info in Long Look.
If he needs even more info, he could take out his iPhone. On the lock screen he should find the Handoff icon of the main iOS app. By swiping it up, he can launch the iOS app into the detail page relevant to the notification.
I saw that the WKUserNotificationInterfaceController class has the updateUserActivity:userInfo:webpageURL: method. But couldn't find a definite answer on the Internet, whether handoff from Long Look is possible. So I'd like to hear your experiences on it :)

If you are using a dynamic notification interface, yes, you can use Handoff from it.
Reference: https://developer.apple.com/watchkit/tips/ Under the "Use Handoff" section.

Related

Trigger apple watch application launch from iPhone [duplicate]

I would like to give a hint to the user, that my iOS app supports the Apple Watch.
So I would like to link/open the Apple Watch companion app from within my iOS app, very much similar to opening the Settings App using ([[UIApplication sharedApplication] openURL: [NSURL URLWithString:UIApplicationOpenSettingsURLString]];)
This shall enable the user to directly navigate to the Watch companion app to setup my app for the watch.
I could not find any URL which would open the companion app in general or specific to a section of the companion app.
If direct linking is not supported, I am also interested in alternative approaches for this use case.
Thanks in advance!
EDIT:
I checked the WatchKitSettings Info.plist file in the simulator to see if it registers any URL schema, but it does not.
I guess it's not possible to programmatically launch the watch companion app from iOS. The opposite way would be possible: to launch the iOS app in the background upon receiving a message from the watch. See WWDC talk Introducing Watch Connectivity.
You could check WCSession.defaultSession().watchAppInstalled and ask the user to launch the app if it is true.
Previously, it was not possible to launch the WatchKit App from the iPhone app, but the iPhone app could be launched—only in the background—with the openParentApplication method.
As of WatchOS 2, however, it is now not possible for either app to cause the other to launch. Instead, there are new methods for queueing changes to be picked up when the other app is launched in the future.
One partial solution for your use case could be displaying a local notification which could be tapped to open the watch app. The primary flaw in such an approach is I do not believe there is a way to limit this notification to the Watch only, so it would also appear on the iPhone where if tapped it would bring the iPhone app to the foreground. Messy if implemented like this, and therefore not worth it I'd have thought, even if it could pass app store review.

watchOS Show App When Message Received [duplicate]

I know that an apple watch app can launch its parent application in the background to pass data back and forth but can it work the other way around? Can my iOS app launch the related watchOS app?
For a bit more insight, I'm trying to accomplish this so that I can monitor data periodically for the sake of notifications. The 70 seconds apple gives me to keep an app active and pulling data from healthKit isn't conducive to an app that provides alerts to users based on changes in behavior.
I apologize if this is a basic question. I'm new to watchOS development and haven't been able to find the answer to this anywhere. =/
No it cannot happen.
At the moment communication between the Watch and the Device is limited to the Watch App initialising communication with the iOS app and not the other way around.
This might help:
https://developer.apple.com/library//ios/documentation/General/Conceptual/WatchKitProgrammingGuide/SharingData.html#//apple_ref/doc/uid/TP40014969-CH29-SW1
Yes, you can. Try the startWatchApp(with:completion:) func in HealthStore. However, it can only be used in a workout app that enable the background mode of "workout processing".
Unfortunately I think I found the answer here How to programmatically open Apple Watch companion app from iOS app.
It doesn't look like it can be done. If anyone finds otherwise, let me know!

How to programmatically open Apple Watch companion app from iOS app

I would like to give a hint to the user, that my iOS app supports the Apple Watch.
So I would like to link/open the Apple Watch companion app from within my iOS app, very much similar to opening the Settings App using ([[UIApplication sharedApplication] openURL: [NSURL URLWithString:UIApplicationOpenSettingsURLString]];)
This shall enable the user to directly navigate to the Watch companion app to setup my app for the watch.
I could not find any URL which would open the companion app in general or specific to a section of the companion app.
If direct linking is not supported, I am also interested in alternative approaches for this use case.
Thanks in advance!
EDIT:
I checked the WatchKitSettings Info.plist file in the simulator to see if it registers any URL schema, but it does not.
I guess it's not possible to programmatically launch the watch companion app from iOS. The opposite way would be possible: to launch the iOS app in the background upon receiving a message from the watch. See WWDC talk Introducing Watch Connectivity.
You could check WCSession.defaultSession().watchAppInstalled and ask the user to launch the app if it is true.
Previously, it was not possible to launch the WatchKit App from the iPhone app, but the iPhone app could be launched—only in the background—with the openParentApplication method.
As of WatchOS 2, however, it is now not possible for either app to cause the other to launch. Instead, there are new methods for queueing changes to be picked up when the other app is launched in the future.
One partial solution for your use case could be displaying a local notification which could be tapped to open the watch app. The primary flaw in such an approach is I do not believe there is a way to limit this notification to the Watch only, so it would also appear on the iPhone where if tapped it would bring the iPhone app to the foreground. Messy if implemented like this, and therefore not worth it I'd have thought, even if it could pass app store review.

iOS Watchkit: Is it possible to show static UI in Watch when app is not reachable?

Can we show some static UI in the watch when iPhone is not reachable to AppleWatch?
Suppose I forgot my iPhone at car seat , and when I move from car, Is it possible to shows some static UI in AppleWatch that you forgot your iPhone?
From an Apple evangelist on https://devforums.apple.com/thread/254576?tstart=0
The end result is that if iPhone is unreachable, the app will not
function. There is not a way to currently cache information to keep it
alive or seemingly so.
Actually you don't have to do anything. I noticed on the real Watch, that Apple will present a default "iPhone unavailable" screen in case the iPhone is out of reach. Similarly, Apple will also present a default "flight mode" screen when the Watch is in flight mode :) . See attached screenshots.
In WatchOS 2, it is now possible to have a WatchKit App that runs on the Watch when the iPhone is not accessible.
Previous answer:
It is clear from Apple's public statements and the WatchKit API that third party developers do not need to manage the connectivity between the watch and the phone, and indeed cannot even if they want to.
Given Apple have publicly indicated that Watch app interactions are expected to be measured in seconds, not minutes, and that developers need to assume that their Watch app could be quit at any time (and the associated WatchKit extension) it seems highly likely that there will not be any option to present static content in the event of the phone being unreachable—as the Watch OS will immediately take over the process of interacting with the user.
It seems almost certain that this will change later in 2015, given developers have been told there will be an SDK to develop 'fully native' apps at that time.
Technically speaking you could start off the app storyboard scene with static content. if the phone is unreachable, then this scene will be displayed. But as soon as your app, whether programmatically or by user interaction attempts to use anything from the WatchKit Extension, a spinner will appear.

Iphone SDK Disable Notifications of Another App

I am writing a simple app (For personal use only) that needs to disable the text message notifications. I am open to how to go about this (disable push notifications of imessage, mute phone, etc.) but everything I read says that apple does not allow an app to modify the user settings. I know there has to be a way to do this, but I have hit a dead end. Does anyone have any suggestions?
Apple doesn't allow this though any official SDK methods.

Resources