Open purarue opened 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
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
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:
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
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