Skip to content
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

Android 5 only: Crash on exit of app while BT off #105

Closed
mattwritescode opened this issue Feb 2, 2015 · 7 comments
Closed

Android 5 only: Crash on exit of app while BT off #105

mattwritescode opened this issue Feb 2, 2015 · 7 comments
Assignees

Comments

@mattwritescode
Copy link
Contributor

For Android 5 devices, while Bluetooth is turned off, app crashes immediately after pressing the home button. This is replicable in the https://github.com/AltBeacon/android-beacon-library-reference.

E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.radiusnetworks.testapp, PID: 18116
java.lang.IllegalStateException: BT Adapter is not turned ON
at android.bluetooth.le.BluetoothLeUtils.checkAdapterStateOn(BluetoothLeUtils.java:136)
at android.bluetooth.le.BluetoothLeScanner.startScan(BluetoothLeScanner.java:106)
at android.bluetooth.le.BluetoothLeScanner.startScan(BluetoothLeScanner.java:101)
at org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop.deferScanIfNeeded(CycledLeScannerForLollipop.java:98)
at org.altbeacon.beacon.service.scanner.CycledLeScanner.scanLeDevice(CycledLeScanner.java:163)
at org.altbeacon.beacon.service.scanner.CycledLeScanner.finishScanCycle(CycledLeScanner.java:258)
at org.altbeacon.beacon.service.scanner.CycledLeScanner.scheduleScanCycleStop(CycledLeScanner.java:231)
at org.altbeacon.beacon.service.scanner.CycledLeScanner$1.run(CycledLeScanner.java:227)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

@davidgyoung
Copy link
Member

Fixed in release 2.1.1

@Tushar-CCI
Copy link

I think there is one instance of this issue still to fix, Line number 173 which causes crash sometimes, find the trace below

java.lang.IllegalStateException: BT Adapter is not turned ON
at android.bluetooth.le.BluetoothLeUtils.checkAdapterStateOn(BluetoothLeUtils.java:136)
at android.bluetooth.le.BluetoothLeScanner.stopScan(BluetoothLeScanner.java:144)
at org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop.deferScanIfNeeded(CycledLeScannerForLollipop.java:173)
at org.altbeacon.beacon.service.scanner.CycledLeScanner.scanLeDevice(CycledLeScanner.java:165)
at org.altbeacon.beacon.service.scanner.CycledLeScannerForLollipop$1.run(CycledLeScannerForLollipop.java:155)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5312)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)

@davidgyoung
Copy link
Member

Nice catch! That was a copy/paste error.

@mattwritescode
Copy link
Contributor Author

Wait, so we need to make another release of android beacon library now? I'm going to wait a week after it comes out before putting it into all the other libraries this time.

Sent from Matt's least favorite form of communication.

On Feb 6, 2015, at 6:55 PM, David G. Young [email protected] wrote:

Nice catch! That was a copy/paste error.


Reply to this email directly or view it on GitHub.

@AlexLardschneider
Copy link

I am still experiencing the same issues in the AltBeacon 2.9

Fatal Exception: java.lang.IllegalStateException: BT Adapter is not turned ON
       at android.bluetooth.le.BluetoothLeUtils.checkAdapterStateOn(BluetoothLeUtils.java:136)
       at android.bluetooth.le.BluetoothLeScanner$1.handleMessage(BluetoothLeScanner.java:85)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:168)
       at android.app.ActivityThread.main(ActivityThread.java:5821)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)

It seems like this issue only happens on HTC devices, as Crashlytics is not reporting crashes on any other devices except HTC.

@davidgyoung
Copy link
Member

Thanks for this report. Catching this exception seems like a reasonable fix.

@davidgyoung
Copy link
Member

Please see #414 for further discussion on a related issue with HTC devices. This issue had a different root cause and is closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants