watchOS Complications deep link to a page in the app
Asked Answered
C

2

8

I am trying to build an app that supports multiple complication families on watch OS2 like modular large, utilitarian large, circular small etc, each showing various meaningful information from the app. I know complications is little similar to the glances we have since OS1 in terms of user interaction i.e, it opens the app on user clicking on it and no special interaction over there.

In glance I was able to do a deep link to the app based on current glance content but I am looking for a way to do the same with complications.

So my question is when the user clicks on my app's complication will I get any sort of context information saying this complication was clicked etc. I am thinking like if I may get a CLKComplication Object in the context.

enter image description here

Any help is appreciated.

Costumer answered 5/8, 2015 at 16:58 Comment(0)
P
6

In ClockKit/CLKDefines.h you can find the CLKLaunchedTimelineEntryDateKey constant.
But you can't define your own user info to help you determine what to do when your app is launched.

From the CLKComplicationDataSource Protocol Reference:

CLKLaunchedTimelineEntryDateKey

A key indicating the date with which the complication was launched. The value of this key is an NSDate object. When the user taps your complication, ClockKit includes this key in the dictionary passed to the handleUserActivity: method of the extension delegate.

Available in watchOS 2.0 and later.

Powerboat answered 12/8, 2015 at 9:18 Comment(3)
Thanks @Fabian this gives me just the date value of the complication that was pressed but I need which family of the complication was pressed too like modular small, large etc.Costumer
That's not supported, sorry. You should file a radar.Powerboat
Yes was thinking of the same, meanwhile lets keep this post open.Costumer
U
1

Since you can get the tapped timeline entry's date via CLKLaunchedTimelineEntryDateKey, you can get the complication type (family) by making "fixed second" for specific type's timeline entry.

Fixed second should be calculated by NSDateComponents and then convert to NSDate that you can pass to CLKComplicationTimelineEntry.

For example, you can specify modularSmall entry's date end with 10 seconds but modularLarge entry's date end with 20 seconds. So, tapped entry with date 9:41:10 AM should be a modularSmall type, and entry with date 9:41:20 AM should be a modularLarge type.

Unific answered 26/8, 2016 at 6:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.