purarue / reminder-sink

a unobtrusive, scriptable reminder/habit/todo task-runner
https://pypi.org/project/reminder-sink/
MIT License
2 stars 0 forks source link

android app that reads from a file and has a persistent notification #4

Open purarue opened 1 year ago

purarue commented 1 year ago

reads from a cache file that a job writes to on computer/phone

could use tasker/termux to write every so often on my phone, incase computer is offline

displays all the items that have expired as a persistent notification on android

https://developer.android.com/develop/ui/views/notifications/channels

purarue commented 1 year ago

could probably just do this with termux-wake-lock and termux-job-scheduler instead of using some other third party app that requires root to schedule tasks

from what Im reading online doesnt seem to use that much battery, but will test and see how it fairs

purarue commented 1 year ago

In fact, can probably optimize this quite a bit to only run when it needs to.

By syncing the resulting reminder file using file sync (syncthing or something else), can check when I open my terminal if its been modified in the last 15 minutes (can set the interval to cache it on my computer to 5 minutes)

If it hasnt been modified, that means my phone isnt able to sync with my laptop, so Im probably out/not on wifi, so should launch termux-wake-lock and termux-job-scheduler so it updates on my phone

can probably also just ignore sync-conflicts, deleting the files since this is just a cachefile thats generated

purarue commented 1 year ago

seems like Id probably want to use

https://developer.android.com/reference/android/app/Notification.Builder.html#setOngoing(boolean)

https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_LOW

and then use a service which gets triggered by alarm manager:

https://stackoverflow.com/a/10420874

purarue commented 1 year ago

reminder that Id need to run termux-fix-shebang on the scheduled script, probably like

# cp script <new path>
termux-fix-shebang <new path>
chmod +x <new path>
termux-job-scheduler -s <new path> --job-id 555 --period-ms 900000
termux-wake-lock

900000 is the min allowed time (15m), job-id is to make sure we only have one ever running, just pick some arbitrary number