1

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?

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

My app is custom push which has to receive message realtime instead of using FCM.
Ok makes sense. A service is your only real option. Unless you want to drop to the native layer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.