kylecorry31 / Trail-Sense

An Android app that uses your phone's sensors to assist with wilderness treks or survival situations.
https://kylecorry.com/Trail-Sense/
MIT License
1.01k stars 66 forks source link

Automations (Triggers, Actions) #2159

Open kylecorry31 opened 5 months ago

kylecorry31 commented 5 months ago

While writing up #2157 I thought it may be useful to let the user trigger behaviors for other things such as time of day, location (geofence), distance travelled, etc. This could also be the foundation of a generic alert mechanism (#1915, #719, #647).

This could be a tasker/IFTTT like feature where the user specifies the trigger and a list of actions that should occur.

This ticket will be focused on converting existing features to automations and not be user facing. After this is implemented, a new ticket can be created for allowing a user facing tool for automations.

kylecorry31 commented 5 months ago

Even if the first iterations aren't user facing, this would be nice to have from a development perspective.

A broadcast receiver that takes in an action ID and executes the associated action(s).

kylecorry31 commented 5 months ago

Triggers

All triggers have the ability to repeat on the next occurrence (indefinitely). Triggers also can send data to the actions (type: number, text, datetime, boolean)

Actions (multiple allowed - executed in sequence):

There will be premade triggers/actions for the existing ones in TS (sunset alert, distance alert, storm alert, daily weather, etc) that can't be deleted but can be enabled/disabled.

Actions should also have access to some data points regardless of what triggers them such as current time, current/daily weather (with the time of the forecast), total distance travelled, current astronomy times/events, etc (come up with a list)

michaelblyons commented 5 months ago

If you add Bluetooth permissions in the future, connect/disconnect of devices would also be a good trigger, #1223. If you don't want to add permissions, that's also reasonable.

kylecorry31 commented 5 months ago

Good idea, thanks!