You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using neatle to connect one or more BLE cycling sensors in an Android app. These are long lasting connections and I'm setting the keepAlive flag in a ConnectionMonitor.
Occasionally, after some time I'm getting the following exception during the connection :
java.lang.IllegalStateException at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:697) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902) at java.lang.reflect.Method.invoke(Method.java:372) at java.lang.reflect.Method.invoke(Native Method) at android.app.ActivityThread.main(ActivityThread.java:5254) at android.os.Looper.loop(Looper.java:135) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Handler.handleCallback(Handler.java:739) at si.inova.neatle.Device$6.run(Device.java:480) at si.inova.neatle.operation.CharacteristicSubscriptionImpl$1.onConnectionStateChanged(CharacteristicSubscriptionImpl.java:56) at si.inova.neatle.operation.CharacteristicSubscriptionImpl.access$000(CharacteristicSubscriptionImpl.java:39) at si.inova.neatle.operation.CharacteristicSubscriptionImpl.subscribeOnDevice(CharacteristicSubscriptionImpl.java:130) at si.inova.neatle.operation.OperationImpl.execute(OperationImpl.java:97) at si.inova.neatle.Device.execute(Device.java:220) at si.inova.neatle.Device.connect(Device.java:388)
I'm doing the following to connect a device (here for a csc sensor) :
final BluetoothDevice device = Neatle.getDevice(macAddress));
final CharacteristicSubscription cscSubscription = Neatle.createSubscription(context, device, Bluetooth.CSC_SERVICE, Bluetooth.CSC_MEASUREMENT_CHARACTERISTIC);
cscSubscription.setOnCharacteristicsChangedListener(sensorDataHandler.getBLEListener());
cscSubscription.start();
final ConnectionMonitor monitor = Neatle.createConnectionMonitor(context, btDevice);
monitor.setOnConnectionStateListener(new ConnectionStateListener() {
@Override
public void onConnectionStateChanged(Connection connection, int newState) {
switch (newState){
case BluetoothAdapter.STATE_DISCONNECTED:
log("sensor "+ sensorName + " disconnected");
break;
case BluetoothAdapter.STATE_CONNECTING:
log("sensor "+ sensorName + " connecting");
break;
case BluetoothAdapter.STATE_CONNECTED:
log("sensor "+ sensorName + " connected");
break;
case BluetoothAdapter.STATE_DISCONNECTING:
log("sensor "+ sensorName + " disconnecting");
break;
}
}
});
monitor.setKeepAlive(true);
monitor.start();`
What am I doing wrong here ? Can you help me ?
Thank you
Robert
The text was updated successfully, but these errors were encountered:
Hi,
I'm using neatle to connect one or more BLE cycling sensors in an Android app. These are long lasting connections and I'm setting the keepAlive flag in a ConnectionMonitor.
Occasionally, after some time I'm getting the following exception during the connection :
java.lang.IllegalStateException at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:697) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902) at java.lang.reflect.Method.invoke(Method.java:372) at java.lang.reflect.Method.invoke(Native Method) at android.app.ActivityThread.main(ActivityThread.java:5254) at android.os.Looper.loop(Looper.java:135) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Handler.handleCallback(Handler.java:739) at si.inova.neatle.Device$6.run(Device.java:480) at si.inova.neatle.operation.CharacteristicSubscriptionImpl$1.onConnectionStateChanged(CharacteristicSubscriptionImpl.java:56) at si.inova.neatle.operation.CharacteristicSubscriptionImpl.access$000(CharacteristicSubscriptionImpl.java:39) at si.inova.neatle.operation.CharacteristicSubscriptionImpl.subscribeOnDevice(CharacteristicSubscriptionImpl.java:130) at si.inova.neatle.operation.OperationImpl.execute(OperationImpl.java:97) at si.inova.neatle.Device.execute(Device.java:220) at si.inova.neatle.Device.connect(Device.java:388)
I'm doing the following to connect a device (here for a csc sensor) :
What am I doing wrong here ? Can you help me ?
Thank you
Robert
The text was updated successfully, but these errors were encountered: