You must run the application (service) on a schedule. It is possible without code samples though if there is a tutorial it would not be bad. The main principle is what to use and what to associate with. And I already goaded. I just have no idea where to dig. What to use calendar? Services? Any services? The application should start regardless of whether it was closed or not, the phone was locked or not. This is not an activation service that communicates with the server (geo positioner). Nothing legal is all in agreement with the user.
2 answers
- Create
Servicewith typeSTART_STICKY - In the service, run background
Thread/Runnable, which according to the schedule asks for what you need - In the service, override the
onTaskRemoved()method, which restarts itself (in the case of its closure).
Then google yourself
|
Depends on the task. Start learning about https://developer.android.com/training/best-background.html
If you need just like an alarm clock - second per second, then AlarmManager will be needed.
If you need to pull something up from the server and the accuracy is not so necessary, then JobScheduler is better (there is a version of JobSchedulerCompat).
|