2017-05-05 49 views
1

Android ble를 사용하여 응용 프로그램을 개발하고 있습니다. 응용 프로그램은 ble를 사용하여 외부 장치와 연결합니다. 외부 장치에는 데이터를 기록하는 센서가 있으며 안드로이드 장치가 범위에 들어 오면 데이터 전송이 시작됩니다. 두 장치가 연결되어있는 경우에 특정 특성을 변경하고, 데이터는 이제이 5-10 분 이내에 센서에 의해 수집 된 데이터에 대해 잘 작동BluetoothServiceJni : 콜백 'btgattc_notify_cb'에 의해 예외가 발생했습니다.

setCharacteristicNoification() --> onCharactericticChanged()

통해 전송된다면 안드로이드 앱 통지를 등록한다. 그러나 장치가 15 분 넘게 범위를 벗어나이 모든 데이터를 전송해야하는 경우 앱이 종료됩니다.

여러 포럼에 대한 책을 읽은에

, 나는 시스템 로그를 확인하고이 오류를 발견

BluetoothServiceJni: An exception was thrown by callback 'btgattc_notify_cb'. 
BluetoothServiceJni: android.os.DeadObjectException 
                 at android.os.BinderProxy.transactNative(Native Method) 
                 at android.os.BinderProxy.transact(Binder.java:496) 
                 at android.bluetooth.IBluetoothGattCallback$Stub$Proxy.onNotify(IBluetoothGattCallback.java:840) 
                 at com.android.bluetooth.gatt.GattService.onNotify(GattService.java:838) 

을이 예외 메시지는 내가이 메시지를 수 차례 반복 한 후

BtGatt.AdvertiseManager: stop advertise for client 5 
BtGatt.GattService: onAdvertiseInstanceDisabled() - clientIf=5, status=0 
BtGatt.GattService: Client app is not null! 
BtGatt.AdvertiseManager: failed onAdvertiseInstanceDisabled 
android.os.DeadObjectException at 
android.os.BinderProxy.transactNative(Native Method) at 
android.os.BinderProxy.transact(Binder.java:496) at android.bluetooth.IBluetoothGattCallback$Stub$Proxy.onMultiAdvertiseCallback(IBluetoothGattCallback.java:874)at com.android.bluetooth.gatt.GattService.onAdvertiseInstanceDisabled(GattService.java:1242) at com.android.bluetooth.gatt.AdvertiseManager$AdvertiseNative.stopAdvertising(AdvertiseManager.java:318)at com.android.bluetooth.gatt.AdvertiseManager$ClientHandler.handleStopAdvertising(AdvertiseManager.java:212) at com.android.bluetooth.gatt.AdvertiseManager$ClientHandler.handleMessage(AdvertiseManager.java:175) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.os.HandlerThread.run(HandlerThread.java:61) 

BtGatt.AdvertiseManager: app died - unregistering client : 5 

그리고 마지막으로 이 메시지 :

BtGatt.ContextMap: Context not found for ID 5

내 코드의 문제점 및 코드의 어떤 부분이이 문제의 원인인지 잘 모르겠습니다. 누구든지이 문제가 어떤 것인지 밝힐 수 있습니까?

답변

0

여러 포럼과 StackOverflow 게시물을 읽은 후,이 코드가 충돌을 일으킬 수있는 오류가 없음을 결론 내 렸습니다.

백그라운드 블루투스 서비스가 전송 된 데이터 양을 처리하지 못했습니다. 사용자 정의 하드웨어가 있으므로 알림 빈도를 줄여 작동시킬 수있었습니다.

이전에 우리는 7.5ms (안드로이드의 최소 연결 간격)에 6 개의 알림 (= 96 바이트)을 보냈습니다. 시간 간격을 10ms로 늘림으로써 앱을 안정화시킬 수있었습니다.

비슷한 문제가있는 사람이 있으면 백그라운드 서비스가 해당 유형의 처리량을 처리 할 수 ​​없기 때문에 데이터 전송 빈도를 줄이는 것이 좋습니다.

+0

권. 어떤 안드로이드 버전과 전화가 있습니까? – Emil

+0

여러 장치에서 Lollipop 및 Marshmellow를 사용하고있었습니다. – Saurabh

+0

콜백에서 얼마나 많은 일을하십니까? – Emil