private void sendKeyPressPackage(final NetworkPackage np) { BackgroundService.RunCommand( getContext(), new BackgroundService.InstanceCallback() { @Override public void onServiceStart(BackgroundService service) { Device device = service.getDevice(deviceId); MousePadPlugin mousePadPlugin = device.getPlugin(MousePadPlugin.class); if (mousePadPlugin == null) return; mousePadPlugin.sendKeyboardPacket(np); } }); }
@Override protected void onStop() { super.onStop(); BackgroundService.removeGuiInUseCounter(this); }
@Override protected void onStart() { super.onStart(); BackgroundService.addGuiInUseCounter(this); }