MobileChromeApps/cordova-plugin-chrome-apps-bluetooth

Events doesn´t trigger in Nexus 6

albertoparras opened this issue · 2 comments

Hi I`m trying this code and the Events doesn´t trigger when I connect to a device:
var app = {
initialize: function() {
this.bindEvents();
},
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
onDeviceReady: function() {
app.receivedEvent('deviceready');
},
receivedEvent: function (id) {
alert("Im ready!!")
chrome.bluetooth.startDiscovery(app.Discover);
chrome.bluetooth.getAdapterState(app.Adaptador);
chrome.bluetooth.onDeviceAdded.addListener(app.Nuevo);
chrome.bluetooth.onDeviceChanged.addListener(app.Conectado);
chrome.bluetooth.getDevices(app.Dispositivos);
},
Discover: function () {
console.log("Start Discover")
},
Adaptador: function (device){
console.log("Adaptador")
console.log(device)
},
Dispositivos: function (device){
console.log("Devices")
console.log(device);
},
Nuevo: function (device){
if (device.connected) {
alert("Device Connected")
}
},
Conectado: function (device) {
if (device.connected) {
alert("Device Connected")
}
}
};

I also find this error when I call the Start Discovery Function:

Attempt to invoke interface method 'int java.util.List.size()' on a null object reference.

Thanks in advanced for the help

Same problem here

Published a new version with the fix to npm (1.1.4)