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.os.IBinder;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.provider.ContactsContract;
|
import android.provider.ContactsContract;
|
||||||
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBDevice.State;
|
import nodomain.freeyourgadget.gadgetbridge.GBDevice.State;
|
||||||
|
@ -75,7 +76,7 @@ public class BluetoothCommunicationService extends Service {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
registerReceiver(mReceiver, new IntentFilter(GBDevice.ACTION_DEVICE_CHANGED));
|
LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver, new IntentFilter(GBDevice.ACTION_DEVICE_CHANGED));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -212,7 +213,7 @@ public class BluetoothCommunicationService extends Service {
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
|
||||||
unregisterReceiver(mReceiver);
|
LocalBroadcastManager.getInstance(this).unregisterReceiver(mReceiver);
|
||||||
GB.setReceiversEnableState(false, this); // disable BroadcastReceivers
|
GB.setReceiversEnableState(false, this); // disable BroadcastReceivers
|
||||||
|
|
||||||
if (mDeviceSupport != null) {
|
if (mDeviceSupport != null) {
|
||||||
|
|
Loading…
Reference in New Issue