private void findSensorId(final Transmitter transmitter, final SensorType sensorType) { RelayrSdk.getRelayrApi() .getTransmitterDevices(transmitter.id) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe( new Subscriber<List<TransmitterDevice>>() { @Override public void onCompleted() {} @Override public void onError(Throwable e) { showToast(R.string.error_loading_devices); } @Override public void onNext(List<TransmitterDevice> devices) { boolean deviceFound = false; for (TransmitterDevice device : devices) { if (device.getModel().equals(sensorType.getModel())) { Storage.getRule().sensorId = device.id; saveTransmitterData(transmitter); deviceFound = true; } } if (!deviceFound) showToast(R.string.error_finding_device); switchToEdit(FragmentName.SENSOR); } }); }
static void initSdk(Context context) { RelayrSdk.init(context); Fabric.with(context, new Crashlytics()); }