Use app context to unregister receiver.

This commit is contained in:
akwizgran
2024-11-04 11:36:20 +00:00
parent 5a34e2c0ab
commit c76a76318c

View File

@@ -222,7 +222,9 @@ public class BriarService extends Service {
super.onDestroy();
LOG.info("Destroyed");
stopForeground(true);
if (receiver != null) unregisterReceiver(receiver);
if (receiver != null) {
getApplicationContext().unregisterReceiver(receiver);
}
// Stop the services in a background thread
wakeLockManager.executeWakefully(() -> {
if (started) lifecycleManager.stopServices();