BluetoothSerial icon indicating copy to clipboard operation
BluetoothSerial copied to clipboard

Error in Success callbackId: BluetoothSerial1953436156 : TypeError: callback.success.apply is not a function

Open sunilk44 opened this issue 5 years ago • 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

sunilk44 avatar Jun 19 '20 11:06 sunilk44

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

  1. Fill a list
  2. loop through this list with onSuccess methods

Hope this helps

MaikStar avatar Jun 22 '20 12:06 MaikStar