简体   繁体   中英

Continuous execution without service and GUI app

If i close app(System.exit) and Service can do background task( with "android:process", so called another process).

But what if i don't even use Service, what can be next alternative?

Thread can not be survive from closing(System.exit).

Alarm Manger can survive and do periodic task, but not continues background task. (As far as i know Alarm Manager can do task only every minuete. not every seconds)

But what about JobService, WorkManager, Firebase JobDispatcher, SyncAdapter?

Can these be survive from System.exit? and can do task every seconds base task?

My first question is why you want to keep doing something even though the user has killed your application.

JobService , WorkManager , Firebase JobDispatcher act like Alarm Manager and will run periodically but with longer intervals (15 mins).

SyncAdapter Requires a service to run.

A Service appears to be your only option but the user can still kill it by going to settings and force closing your application and all of its services.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM