About the practice of using Service to keep alive (1)

The way we use startService, we
Insert image description here
Insert image description here
can find that when the return value is START_STICKY, even if the application is closed manually or closed with a shell command, the Service will continue to restart.

Insert image description here
Insert image description here
When the return value is START_NOT_STICKY, even if you manually close the application or use a shell command to close it, the Service will not be restarted.

Guess you like

Origin blog.csdn.net/liuzhuo13396/article/details/122299685