faq how to write "observation" app or like alarm clock

I've written wf, df and time to app Slight smile

I need some quick help to not spend time on testing.

Short description, user:

-go to the app and choose form menu [start observation] (for example steps/hr etc or set alarm)

- go somewhere else (activity, wf)

- app should run in background an "observe" for some event from system or from app

question/answers

- when app is in foreground

-- is the same rules like in wf/df system call onUpdate/onPartialUpdate and burn in protection?

--is any system controls

--- like in std alarm clock app (list)

---time picker

---etc. or I should implement everything myself

- when in background

-- how to run code: should I start timer on app.onStop() to do something in background (quick tests show that app exits)

-- is it possible to show view/alarm/vibrate when event happens?

I don't have much time so If it big work I'd like to know before Slight smile

thx

  • Looks like Application.Storage can store up 128 KB (per app, I assume). The docs are little inconsistent.

    setValue() will throw an exception if there isn't enough space, so you can use this fact to implement some kind of circular history list for your app. (Once storage is full, delete oldest history item and try again.)

    Seems like this would work as long as you don't need to export data from the app.

    https://developer.garmin.com/connect-iq/api-docs/Toybox/Application/Storage.html

    There is a limit on the size of the Object Store that can vary between devices. If you reach this limit, the value will not be saved and an exception will be thrown. Also, values are limited to 32 KB in size.

    https://developer.garmin.com/connect-iq/core-topics/persisting-data/

    Accessing Storage: Application.Storage (Connect IQ 2.x)

    Connect IQ 2.4 introduces the Application.Storage module, which manages persistent key-value pair data storage. Information is automatically saved on disk when Storage.setValue() is called. Keys and values are limited to 8 KB each, and a total of 128 KB of storage is available.

  • I've made first tests. And it look like battery is drained but not sure. Because there is still a lot of work so I have to know earlier about potential problem. 

    1. Is real low power mode (saving device resource like speed of processor) or it's only software - calling onPartial instead on onUpdate

    2. When run app backlight often on even sleep time (I know it because I work late in night), why? wh isn't on backlight in night. Is app and df treat in different way? Are they both always on?

    3. My app first few minutes run timer than do nothing even draw (black screen after one dc.clear(). What exactly is happening on the watch then? What is difference between app and wf?

  • Next test :  app do nothing: no draw, no backlight, black screen,  only one timer started and should call onTimer in 8 hours fenix 6pro, after 5h waiting for onTimer (do nothing) it consumes 14% battery - after 24 hours it will be almost 70% it's about 4 time more than my wf which is full drawn every minutes  and eversecond in onPartial

    Can anybody answer this i previous my question? It's important, because I don't want spend a few months to write app and than tell user to charge battery evryday and even in night when watch should be on wrist