termux / termux-api-package

Termux package containing scripts to call functionality in Termux:API.
MIT License
1.02k stars 318 forks source link

termux-job-scheduler always defaulting to 900000 milliseconds #77

Closed heywoodlh closed 5 years ago

heywoodlh commented 5 years ago

when trying to schedule a job to run every 300000 milliseconds using the --period-ms flag, it always goes to 900000 milliseconds.

$ termux-job-scheduler --period-ms 300000 --script /data/data/com.termux/files/home/scripts/check-shell.sh --network any

Scheduling Job 0: /data/data/com.termux/files/home/scripts/check-shell.sh       (periodic: 900000ms) (battery not low) (network: NetworkRequest [ NONE id=0, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&VALIDATED Unwanted:  Uid: 10121] ]) - response 1

What am I doing wrong? Or is this a known issue?

xalexalex commented 5 years ago

Since Android N there's a minimum period below which you can't go ([JobInfo.getMinPeriodMillis()](https://developer.android.com/reference/kotlin/android/app/job/JobInfo.html#getMinPeriodMillis())) and it is 900.000 ms (15 minutes).

I just added it to the documentation and it will be available in the next version of the termux-api package.

Thanks for pointing this out!

heywoodlh commented 5 years ago

Thanks for the quick response @xalexalex :)

xalexalex commented 5 years ago

Gotta make these August Sundays useful somehow! Glad I could help :smile: