Shut down cleanly when phone is shutting down or memory is low
Listen for ACTION_SHUTDOWN
and QUICKBOOT_POWEROFF
broadcasts and try to shut down the background service cleanly before the phone powers off.
Similarly, try to shut down the service cleanly before the process is killed if BriarService#onLowMemory()
is called.