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

  • for me it's enough information to write this app

    It is sense to run this app only during sleep so user don't have to see on watch so it can run in foreground all the time, I implement battery saving or even black screen

    by the way, is any message from system when user makes gesture to see watch? maybe than is onUpdate called and I can differentiate my update call form system call?

  • People also asked about "detect wrist turn" support for data fields and apps. I think the answer was that they were going to support it, but then they exposed accelerometer data instead, so you have to code it yourself.

    developer.garmin.com/.../AccelerometerData.html

  • It is sense to run this app only during sleep so user don't have to see on watch so it can run in foreground all the time, I implement battery saving or even black screen

    Sure, but I wonder if it will still consume more battery than just using the watch normally during sleep, even without updating the screen. I guess you will have to find out.

  • But you have written a few post ago that it would consume less than wf Slight smile

    It will be one timer or two if there will be notification from system about gaze on watch.

  • Sure, less than a CIQ WF. I was thinking about native WF. But good point haha.

  • and another question, if I'd like to save statistic from every night is any place fro it? How much memory I can use to store data? I don't want to put in memory all. is't possible out of df create own df data and synchronise it to Garmin connect?

  • In a data field or device app you can record data to a FIT file which is synced to Garmin Connect as an "activity" (e.g. running, walking, generic.). In a data field you would record data to the existing activity session, while in a device app you would create a new activity session.

    This will likely consume more battery life, and it will consume more RAM for sure.

    developer.garmin.com/.../

    https://www.programmableweb.com/news/how-to-record-application-metrics-garmin-connect-iq/sponsored-content/2016/11/14

    Other than that, the only other ways to record data (so that it can be accessed externally) would be:

    - Ask users to create application LOG file and use System.println. (One app for recording HR during sleep does this)

    - Use makeWebRequest() and save data to an external service. (A data field can only do this with a background service.)

  • no, no I'd like to save history

    1. I've just I can use

    Toybox.FitContributor

    and start activity but I think it will drain battery

    2. save data but I know using set/getProperty cause loading all properties to memory

    3. what about

    Toybox.Application.Storage

    is the same situation

    4. I need something to save and read like sensor history

  • Sure of course you can use Application Storage to save whatever you want, but how do you get it off the app and into the outside world?

    create own df data and synchronise it to Garmin connect?

    Based on this, I thought you wanted data that would show up in Garmin Connect.

  • 1. The problem is that I have idea but not sure how to implement it. So I have to collect some data than analyse it and write good algorithm. I need go sleep start app and saving data from watch and get it next day.

    2. For end user I'd like some kind of statistic and need save some data and read. Assume somebody will use app for year I'm sure i will problem to load property to memory I need something like getSensorHistory