I want to know if there is a way to keep the service running when the activity process is killed.
No, there is no way to save the service. Because
Closed by the user via the Running Services screen in Settings. Closed by the user via a task killer. Closed by Android to free up memory in times of need.
Continue the BAD service.
But you can do
-> you can restart the service using the BROADCAST RECEIVER . (for an incoming call, termination of BOOT, received SMS, etc., use this depending on your requirement)
source share