From 14e97545e4d30c8a2661a9157d55cdc935167e0b Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Thu, 25 Aug 2016 18:06:56 +0200 Subject: [PATCH] Unpair on error --- .../kdeconnect/Backends/LanBackend/LanLinkProvider.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/org/kde/kdeconnect/Backends/LanBackend/LanLinkProvider.java b/src/org/kde/kdeconnect/Backends/LanBackend/LanLinkProvider.java index 1b1eda0a..1c728381 100644 --- a/src/org/kde/kdeconnect/Backends/LanBackend/LanLinkProvider.java +++ b/src/org/kde/kdeconnect/Backends/LanBackend/LanLinkProvider.java @@ -249,6 +249,15 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis } } catch (Exception e) { e.printStackTrace(); + BackgroundService.RunCommand(context, new BackgroundService.InstanceCallback() { + @Override + public void onServiceStart(BackgroundService service) { + Device device = service.getDevice(deviceId); + Log.e("LanLinkProvider", "Unpairing "+(device != null)); + if (device == null) return; + device.unpair(); + } + }); } }