Sample of CIQ Complication Publisher and Consumer of those Complications

Here are two apps. 

The first publishes Complications in a CIQ app.  There is a background services and it publishes a string with the time as "HH:MM" every 5 minutes.  It publishes 3, with one being public, one being protected, and one being private.

0675.CompPub.zip

The second app is a watch face that consumes the above complications.

CompCon.zip

Both apps have a 945 as a target (it doesn't have complications) and a 955 and 965 which do.

  • God morning, thanks for making available these sample apps! One question about the first one with the background service. In the views you access the variable bgData, which is only defined in AppBase. How does this work? I just tried it, and in my app the view could not access a member of AppBase like this.

  • bgData is a global, and it's vaue gets set in 2 ways.  in onBackgroundData for the main app and in onTemporalEvent for the background service.  This is needed as each process has it's own copy of that variable..

    In onStop I see if that's being called by the background service, and if so I look to publish the complication.  onStop is called when the main app exits, but also each time the background service exits.

  • Understand, thanks!