Update to v3.24.0

Last Updated on : 2024-11-18 11:33:17download

Description

After the SDK for Android is updated to v3.24.0 or later, the firmware update listener IOtaListener is added with the onStatusChanged method. You can call this method to get the device update status.

Make sure that the onStatusChanged method is implemented for IOtaListener in all modules of your app. Otherwise, runtime exceptions might occur.

API description

iTuyaOta.setOtaListener(new IOtaListener() {
		@Override
		public void onSuccess(int otaType) {

		}

		@Override
		public void onFailure(int otaType, String code, String error) {

		}

		@Override
		public void onFailureWithText(int otaType, String code,
									OTAErrorMessageBean messageBean) {

		}

		@Override
		public void onProgress(int otaType, int progress) {

		}

		@Override
		public void onTimeout(int otaType) {

		}

		@Override
		public void onStatusChanged(int otaStatus, int otaType) {
			// New features of v3.24.0

		}
});

Parameters

Parameter Description
otaStatus The firmware update status. Valid values:
  • 1: device ready for update
  • 2: updating
  • 3: updated
  • 4: update exception
  • 7: update timeout
otaType The type of device to be updated. For more information, see the type field of UpgradeInfoBean.

References

Add a listener