mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-02-09 08:26:48 +01:00
[Bangle.js] remove uart.tx intent-listener on dispose
This commit is contained in:
parent
cbf98b9308
commit
2e06d7afa5
@ -157,6 +157,9 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
private Timer gpsPositionTimer;
|
private Timer gpsPositionTimer;
|
||||||
private final int gpsUpdateTimerInterval = 1000;
|
private final int gpsUpdateTimerInterval = 1000;
|
||||||
|
|
||||||
|
// this stores the globalUartReceiver (for uart.tx intents)
|
||||||
|
private BroadcastReceiver globalUartReceiver = null;
|
||||||
|
|
||||||
/// Maximum amount of characters to store in receiveHistory
|
/// Maximum amount of characters to store in receiveHistory
|
||||||
public static final int MAX_RECEIVE_HISTORY_CHARS = 100000;
|
public static final int MAX_RECEIVE_HISTORY_CHARS = 100000;
|
||||||
/// Used to avoid spamming logs with ACTION_DEVICE_CHANGED messages
|
/// Used to avoid spamming logs with ACTION_DEVICE_CHANGED messages
|
||||||
@ -179,6 +182,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
GBApplication.getContext().unregisterReceiver(globalUartReceiver); // remove uart.tx intent listener
|
||||||
stopLocationUpdate();
|
stopLocationUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +241,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
private void registerGlobalIntents() {
|
private void registerGlobalIntents() {
|
||||||
IntentFilter commandFilter = new IntentFilter();
|
IntentFilter commandFilter = new IntentFilter();
|
||||||
commandFilter.addAction(BANGLE_ACTION_UART_TX);
|
commandFilter.addAction(BANGLE_ACTION_UART_TX);
|
||||||
BroadcastReceiver commandReceiver = new BroadcastReceiver() {
|
globalUartReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
switch (intent.getAction()) {
|
switch (intent.getAction()) {
|
||||||
@ -270,7 +274,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
GBApplication.getContext().registerReceiver(commandReceiver, commandFilter);
|
GBApplication.getContext().registerReceiver(globalUartReceiver, commandFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user