cordova-plugin-bluetoothle
cordova-plugin-bluetoothle copied to clipboard
retrieveConnected returns empty array
Using a Samsung S8 with Ionic/VueX/Capacitor, here is my code:
getConnected: ({commit, state, dispatch}) => {
return new Promise((resolve, reject) => {
window.bluetoothle.retrieveConnected(
function (success) {
if (success.length === 0) {
console.log('retrieveConneccted is empty!');
} else {
commit('setIsConnectedTo', success)
}
console.log('getConnected: retrieveConnected: success:', success);
resolve();
},
function (error) {
commit('setIsConnectedTo', null)
console.log('getConnected: retrieveConnected: error:', error);
reject();
},
{
"services": [
SERVICE_180D,
SERVICE_180F
]
}
);
})
},
retrieveConnected's success function is always returning an empty array. I have tried invoking it without params as well.
So it seems this only returns the paired devices. How are you supposed to figure out what you are connected to then!?!?
Have an similar problem on Iphone. After hot reload my iphone stays connected to my device but there is no possibility to kill that connection.