Error in Success callbackId: BluetoothSerial1953436156 : TypeError: callback.success.apply is not a function
sunilk44 opened this issue · 1 comments
bluetoothSerial.write(txt.toString() + '\n', success,failure);
Error in Success callbackId: BluetoothSerial1953436156 : TypeError: callback.success.apply is not a function cordova.js:294 Uncaught (in promise) TypeError: callback.success.apply is not a function at Object.callbackFromNative (cordova.js:294)
at processMessage (cordova.js:1120)
at processMessages (cordova.js:1143)
I am running this fucnction in loop and sometime it gives above error and i did't get the issue behind it.
And after that error hangs up on the screen
please suggest me something to resolve above Error
You can't use bluetoothSerial.write in a loop.
Like
for (var cnt=0;cnt<=10;cnt++)
bluetoothSerial.write
Because it's a async call
So you have to use success method
- Fill a list
- loop through this list with onSuccess methods
Hope this helps