mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-24 02:46:50 +01:00
Register with the LocalBroadcastManager for device_changed
Otherwise intents sent with LocalBroadcastManager won't ever arrive.
This commit is contained in:
parent
7b4c7926d3
commit
0e34a449ca
@ -15,6 +15,7 @@ import android.net.Uri;
|
||||
import android.os.IBinder;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.ContactsContract;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBDevice.State;
|
||||
@ -75,7 +76,7 @@ public class BluetoothCommunicationService extends Service {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
registerReceiver(mReceiver, new IntentFilter(GBDevice.ACTION_DEVICE_CHANGED));
|
||||
LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver, new IntentFilter(GBDevice.ACTION_DEVICE_CHANGED));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -212,7 +213,7 @@ public class BluetoothCommunicationService extends Service {
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
unregisterReceiver(mReceiver);
|
||||
LocalBroadcastManager.getInstance(this).unregisterReceiver(mReceiver);
|
||||
GB.setReceiversEnableState(false, this); // disable BroadcastReceivers
|
||||
|
||||
if (mDeviceSupport != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user