SDK gets stuck when updating firmware

I’m testing with a beacon currently at firmware A2.2.0 to update it to A3.0.1 through the Android SDK.

Progress will get to about 30% and then just stop.
The BeaconOta Callback isn’t firing the onFailure event and stops firing onProgress events after the first 3.

For this particular issue, no exceptions have been thrown by the SDK that I can trace back.

I’ve had a similar issue when attempting to update beacon firmware through the Estimote Android app. It worked on one beacon but wouldn’t work on another, forcing me to update via the Estimote iOS app.

Now I need to be able to validate that beacon firmware can be updated through the SDK or this will just be a problem waiting to happen.

@Jon_PS Do you have nearby iOS device? If so can you download Estimote app from App Store and try with it? I want to check if there is problem with Android SDK or with beacon itself.

Unless I can also downgrade the firmware through the app, I would be hesitant to do so. I only have two A2.2.0 beacons with me to test with. If I update them both via the Estimote app, I will be unable to test the updating through the SDK.

I’ll see what more data I can gather and come back.

So I just went through updating the beacon firmware via the iOS app.
First it wouldn’t start until I physically placed the beacon on the screen.
Next, it paused for a while at 10% for a few more seconds than expected.
But it did eventually update without any complications.

I only have one other beacon with me that is still on firmware A2.2.0.

I attempted to update this one via the the Android SDK.
It went up to 10% and stayed there for almost a full minute.
It went up to 20% and doesn’t seem to be moving from there.

20% internally means that it stuck at downloading new firmware. Are you able to send logcat from the device (with EstimoteSDK tag) so I can have more data?

In the meanwhile I’ll take 10 beacons and look for the problem. Thanks for reporting.

Well, it looks like after updating that beacon with the Estimote iOS app, it’s no longer visible to iOS.

The Estimote Android app picks it up and is showing it to be on firmware version B2.0
Not sure what happened here.

I updated it via the Android app. After that, the iOS app could detect it again.
Not sure what happened here.

B2.0 indicates that beacon is in bootloader (intermittent state during software update).

  1. Are you able to provide me logcat from Android device that failed the update?
  2. Can you restart Bluetooth (turn off & on again) on Android device? Or simply restart device and try again?
  3. iOS app will pick beacon in bootloader when you are on radar screen. Popup will be shown that you have one old device and present you info to update it.

That would explain what happened when the update got stuck at 20%.

And yes, the popup did show up on the iOS app.

I’ll have to come back to this later as right now we’re shifting gears to iOS and getting that project out the door as quickly as possible.

@Jon_PS when you have spare time please so help us make more robust Android SDK, thanks a lot

I’ll soon be providing what info I can on this issue. Problem is that right now beacon authentication is failing and I’m not entirely sure if that’s a problem with Estimote Cloud.

Once I can get past that, I will be able to go back to tackle the firmware update.

@wiktor
Last test we did with this also got stuck at 20% when attempting to update firmware on the Android SDK.

We’re doing what we can to work around this, but it would be good to be able to have our app handle the case of a beacon that needs new firmware.

  1. Are you able to provide me logcat from Android device that failed the update?
  2. Can you restart Bluetooth (turn off & on again) on Android device? Or simply restart device and try again?

After restarted the Android device and trying again, updating got stuck at 10%.
The beacon is less than 6 inches from the device.

I’m still working to get the logcat since it’s constantly logging even when the app itself isn’t active, I’m trying to narrow it to just the time it’s updating. I’ll upload a txt file of that shortly.

@wiktor
The logcat begins when the device first checks the beacon’s firmware for updates.
Once it started the firmware update process, it got stuck at 10%. I cut down the logcat after almost 2 minutes of being stuck at 10%.

firmwareCheckUpdate_logcat.txt (382.7 KB)

@Jon_PS

I took a look at logs you provided. There is an error throw from your code that breaks update flow. Can you fix that?

07-03 09:08:07.578 9002-9016/com.digitalwavefront.traveltag_android W/BluetoothGatt﹕ Unhandled exception in callback
android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6347)
at android.view.ViewRootImpl.invalidateChildInParent(ViewRootImpl.java:904)
at android.view.ViewGroup.invalidateChild(ViewGroup.java:4335)
at android.view.View.invalidate(View.java:10976)
at android.view.View.invalidate(View.java:10931)
at android.widget.TextView.checkForRelayout(TextView.java:6804)
at android.widget.TextView.setText(TextView.java:3947)
at android.widget.TextView.setText(TextView.java:3805)
at android.widget.TextView.setText(TextView.java:3780)
at com.digitalwavefront.traveltag_android.Activities.BagDetailActivity.BeaconFirmwareUpdateProgress(BagDetailActivity.java:688)
at com.digitalwavefront.traveltag_android.EstBeaconServices.EBeaconConnector$4.onProgress(EBeaconConnector.java:177)
at com.estimote.sdk.connection.BeaconConnection$12.onProgress(BeaconConnection.java:394)
at com.estimote.sdk.connection.BeaconOta.downloadFirmware(BeaconOta.java:132)
at com.estimote.sdk.connection.BeaconOta.access$500(BeaconOta.java:35)
at com.estimote.sdk.connection.BeaconOta$2$1.onUpdateNeeded(BeaconOta.java:113)
at com.estimote.sdk.connection.internal.ota.RebootDeviceIfUpdateNeeded$1.onDisconnected(RebootDeviceIfUpdateNeeded.java:68)
at com.estimote.sdk.connection.internal.ota.BeaconNoCloudConnection$InternalCallback.onDisconnected(BeaconNoCloudConnection.java:283)
at com.estimote.sdk.connection.internal.bluerock.BlueRock.notifyDisconnected(BlueRock.java:241)
at com.estimote.sdk.connection.internal.bluerock.BlueRock.access$100(BlueRock.java:37)
at com.estimote.sdk.connection.internal.bluerock.BlueRock$1.onConnectionStateChange(BlueRock.java:100)
at android.bluetooth.BluetoothGatt$1.onClientConnectionState(BluetoothGatt.java:168)
at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:71)
at android.os.Binder.execTransact(Binder.java:407)
at dalvik.system.NativeStart.run(Native Method)

The class BluetoothGatt isn’t my code.
I’ve detailed a problem I’ve been having with it on another topic.

I’m going to see if wrapping the update calls to my UI in runOnUiThreads and see if that takes care of the issue we’re seeing.
It would be nice to be able to see in the documentation where code execution is happening during BeaconManager callbacks. Then I wouldn’t have to be guessing which callbacks need to be wrapped and which don’t.

You are correct. For beacon update we were not explicit about threads on which callbacks are invoked. We will make that change to update it on main thread and also changes in docs.

Could be post result after wrapping progress showing in runOnUiThread ?

I watched the app update the firmware.
I can’t believe that’s what it took. After weeks of uncertainty.

There’s still a couple things that didn’t seem right. They might be issues with my code so I will see if I can confirm. I might not have another beacon in need of firmware updating.

I was sending the messages from the onProgress callback to short toasts.
Progress got as far as 95% and then the toast showing “Flushing app” just got stuck until I restarted the app.
I’m going to work around that but at least the firmware was successfully updated in the progress.

It is always the small things :).

Check you onSuccess callback as there might be similar situation.

Has this fix been made available to the estimote app in the google play store? I was using the app (downloaded today) and tried to upgrade a 3.1.0 to 3.1.1 and it died at 25%. I’m no longer able to see the device in the estimote software.

Is there a process for recovering from failed firmware updates?

– charles