-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bluetooth Low Energy scan failed with error code: 2 #48
Comments
Thanks @rothariger for reporting this :) Could you try disabling additional features when building your ProximityObserver object? There are two of them enabled by default - Telemetry scanning, and Estimote Secure Monitoring. If you don't need to use them, you can disable them like this: proximityObserver = ProximityObserverBuilder(applicationContext, cloudCredentials)
...
.withEstimoteSecureMonitoringDisabled()
.withTelemetryReportingDisabled()
...
.build() The above should reduce the number of BLE callbacks being registered in OS, thus reducing the possibility of Scan error 2. |
Yep already tried that didn't help. |
+1 Crashlytics stats: |
I'm also getting this crash. I'm attaching my stacktrace from Crashlytics:
|
Please fix this crash soon. |
I get the exact same error here too. |
I have same error on Xiaomi 5A |
any update? I get it on few devices its so random |
phone restart helps but only for a few hours |
I am also getting the same error. Proximity observation error: Bluetooth Low Energy scan failed with error code: 2 It works sometime and sometime throws error. @pawelDylag could you please help with the possible solution? |
Hello, I have the same problem which is described above. Android Proximity SDK version: 1.0.3 After several hours to debug my application in a few devices, in my console (Logcat), i have this error, E/BtGatt.GattService: App is scanning too frequently. After 2 seconds my application is crashed with the same error code. I wish I helped you. |
I also have this error... |
@pawelDylag I'm having the same problem, also tried above proposed solutions. This seems to be a critical yet active issue since May 2018. The intermittence of this error means we cannot deploy this into active production. Are there plans to look into this? |
Tested on couple modern devices, but issue occurs on some of them. Please fix it finally! |
Hello @pawelDylag At least you should handle this exception at your side as it causes crashes to our development apps, and we can't handle it as it gives crashes from inside your SDK, check this exception:
Or give us away to handle it. We don't want a fix to reduce the number, you should give us a reliable solution to handle the issue or fix it totally. |
Hey guys! I'm super sorry for not answering you for a while. We have tons of work here, and I work on multiple projects, so it's sometimes difficult to keep up with all of those. But no excuses! As for your problem - I will add this to my backlog to dig deeper into this error, though I had some problems with reproducing it AFAIR. For the time being you can think of using global RxJavaPlugins.getInstance().registerErrorHandler(new RxJavaErrorHandler() {
@Override
public void handleError(Throwable e) {
e.printStackTrace();
}
}); It's an ugly solution, but sometimes you encounter bugs in RxJava that you can't deal in a proper way. So you have to use this global listener. We're not using it internally (because we hate ugly solutions), so this is why it's crashing. We may need to think about using it for a long term, because hey... it's crashing your apps, doesn't it? Lemme know if that helps in any way. I will keep you all updated when I finally got some time to fix that on our side :) Best wishes 🚀, |
Hi, just to let you know that capturing the error alone won't do as the SDK stops receiving proximity alerts after that. The only way is to turn on and off Bluetooth.
Sent from Yahoo Mail on Android
On Thu, 13 Dec 2018 at 18:08, Pawel Dylag<notifications@github.com> wrote:
Hey guys!
I'm super sorry for not answering you for a while. We have tons of work here, and I work on multiple projects, so it's sometimes difficult to keep up with all of those. But no excuses! As for your problem - I will add this to my backlog to dig deeper into this error, though I had some problems with reproducing it AFAIR. For the time being you can think of using global onError handler to prevent your app from crashing. Just register code like this:
RxJavaPlugins.getInstance().registerErrorHandler(new RxJavaErrorHandler() {
@OverRide
public void handleError(Throwable e) {
e.printStackTrace();
}
});
Lemme know if that helps in any way. I will keep you all updated when I finally got some time to fix that on our side :)
Best wishes 🚀 ,
Paweł
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Its 2019 ! |
Umar, it's time to move on... |
@rothariger It really seems the only way now. It's really weird such a major issue is open and they couldn't give a proper solution for it. |
Yep, and the worst part is that they don't give any update on this... |
@rothariger yes exactly, and also I mean I don't think everyone uses iOS devices for such beacon activities, it should be a major chunk of their revenue (from android side) and should have been given priority, because number of devices effected in Android > iOS always. |
I can manage the exception adding this code on ProximityContentManager.java on start() function.
#See RxJava What's different in 2.0 error for more info# At least it doesn't crash! Hope it helps! 👍 |
Yea I did the same.
It doesn't crash that's all. Doesn't fix the issue though.
On Tue, 29 Jan 2019 at 17:38, IreneTrullen ***@***.***> wrote:
I can manage the exception adding this code on
*ProximityContentManager.java* on *start()* function.
RxJavaPlugins.setErrorHandler(e -> {
if (e instanceof UndeliverableException) {
e = e.getCause();
}
if ((e instanceof IOException) || (e instanceof SocketException)) {
// fine, irrelevant network problem or API that throws on cancellation
return;
}
if (e instanceof InterruptedException) {
// fine, some blocking code was interrupted by a dispose call
return;
}
if ((e instanceof NullPointerException) || (e instanceof IllegalArgumentException)) {
// that's likely a bug in the application
Thread.currentThread().getUncaughtExceptionHandler()
.uncaughtException(Thread.currentThread(), e);
return;
}
if (e instanceof IllegalStateException) {
// that's a bug in RxJava or in a custom operator
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
return;
}
Log.w("Undeliverable exception received, not sure what to do", e);
});
#See RxJava What's different in 2.0 error for more info#
<https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling>
At least it don't crash!
*Hope it helps!* 👍
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#48 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF_DUMl1sAsQsI5MbbX8Yz93VWHA2LGJks5vIHkDgaJpZM4T0wfG>
.
--
Sent from Gmail Mobile
|
There's really two problems here:
|
Got the same issue on Cubot J3, Android Oreo 8.1.0. Opened a new issue #94. Please provide us with a fix guys! |
Guys when are you planning to fix this. We are getting this a lot in production. |
Hey @vardaan, please see my explanation of the root cause of the "error code 2". https://forums.estimote.com/t/postlollipopestimotescanner-kt-line-29/9745/2?u=heypiotr If you're getting this error in your production app, it's very likely that you're not managing the lifecycle of the Proximity Observer properly. If you believe you're doing everything right, please post a new issue with all the details we ask for in the issue template + your code (especially the bits where you starts/stop the observer) + full output from logcat (don't use the "my app only" filter, we want to see the logs from the system Bluetooth services). |
Prerequisites
Basic information
Estimote SDK version: 5.0.0
Android devices affected: Xiaomi Redmi Note 4
Android OS version affected: 7.1.1
Beacon hardware version: G1.12
Description
[Description of the issue]
I'm getting an Exception that crashes the App when starting to scan for beacons. For some reason this happens mostly on the listed devices, but it is also possible to trigger on other devices by turning off and on the Bluetooth before and/or after the scanning starts.
extra information about this issue, if i put the code in the main activity, it doesn't crash the application and i got the exception in withOnErrorAction, now we had to configure the scan in a service, because we want to be running in background whether the application is running or not.
Because of this change the entire application crashes, that's not what i've expected.
(Optional) Steps to reproduce:
There are no several steps, just one, trying to configure the beacons as the downloaded example.
Expected behavior:
Start the scanning?
Actual behavior:
Crashes with exception.
Additional information
W/System.err: io.reactivex.exceptions.UndeliverableException: java.lang.Exception: Bluetooth Low Energy scan failed with error code: 2
W/System.err: at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:349)
W/System.err: at io.reactivex.internal.operators.observable.ObservableCreate$CreateEmitter.onError(ObservableCreate.java:74)
W/System.err: at com.estimote.scanning_plugin.packet_provider.scanner.PostLollipopEstimoteScanner$scan$1$callback$1.onScanFailed(PostLollipopEstimoteScanner.kt:29)
W/System.err: at android.bluetooth.le.BluetoothLeScanner$1.run(BluetoothLeScanner.java:478)
W/System.err: at android.os.Handler.handleCallback(Handler.java:754)
at android.os.Handler.dispatchMessage(Handler.java:95)
W/System.err: at android.os.Looper.loop(Looper.java:165)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6365)
at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:883)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
W/System.err: Caused by: java.lang.Exception: Bluetooth Low Energy scan failed with error code: 2
... 9 more
W/MIUI-BLOCK-MONITOR: The binder call took 3622ms.
java.lang.Throwable
at android.os.AnrMonitor.checkBinderCallTime(AnrMonitor.java:607)
at android.os.BinderProxy.transact(Binder.java:623)
at android.app.ActivityManagerProxy.handleApplicationCrash(ActivityManagerNative.java:5190)
at com.android.internal.os.RuntimeInit$KillApplicationHandler.uncaughtException(RuntimeInit.java:190)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063)
at io.reactivex.plugins.RxJavaPlugins.uncaught(RxJavaPlugins.java:411)
at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:365)
at io.reactivex.internal.operators.observable.ObservableCreate$CreateEmitter.onError(ObservableCreate.java:74)
at com.estimote.scanning_plugin.packet_provider.scanner.PostLollipopEstimoteScanner$scan$1$callback$1.onScanFailed(PostLollipopEstimoteScanner.kt:29)
at android.bluetooth.le.BluetoothLeScanner$1.run(BluetoothLeScanner.java:478)
at android.os.Handler.handleCallback(Handler.java:754)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:165)
at android.app.ActivityThread.main(ActivityThread.java:6365)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:883)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
The text was updated successfully, but these errors were encountered: