Architecture of background app

Former Member
Former Member

Hi

I want to implement an app that has the following functionality:

- It has a background process that is called at some specific times
- This process checks a condition
- If the condition is met, we play an alarm and display a warning message to the user, allowing them to acknowledge it

Before I start working on the implementation I wanted to confirm that the architecture that I have in mind is the right one:
- This will be an app with a main foreground service and a background service
- The background service is the one that gets woken up by the system and which checks the condition
- If the condition is met, the foreground app is started and this is the one that plays the alarm and shows the confirmation
- The foreground app will be a normal app, not a data field, widget or watch face

Can you please let me know if you think that my approach is correct? I am a newbie in Garmin development and don't want to start on the wrong path

Thanks in advance!!

Barel

  • You can come close to what you're thinking.  Let's say you set up a background that runs every 5 minutes to check what's going on. (every 5 minutes is the most frequently the background can run on a time basis).

    Whatever condition it is is met at some point, and then  the background calls requestApplicationWake().  The user then is asked if they want to launch the main app.  If the user says ok, the main app is launched.

    If you want to see what this is like, install garmin's hydration widget: https://apps.garmin.com/en-US/apps/6cb03839-6c01-42ac-8acf-6c54801cc9ae

    and turn on the alarm for 1 hour.  You'll get a message about launching the hydration widget to add to the log every hour or so.