var adapter = tizen.bluetooth.getDefaultAdapter();
Tizen Studio says: "The API(attribute) 'bluetooth' of object 'tizen' is not allowed"
I set <tizen:privilege name="http://tizen.org/privilege/bluetooth"/>
Also "Signature error -14" somtimes appears when I'm adding that privilege without "var adapter = tizen.bluetooth.getDefaultAdapter();"
Anyways nothing works correctly...
I've been trying to use different Tizen versions: 2.4, 3.0
I'm struggling to manage a button which sets ON\OFF Bluetooth via AppControl. Please, help.
Maybe some one has done solution? I'm using this code:
var bluetoothSwitchAppControl = new tizen.ApplicationControl('http://tizen.org/appcontrol/operation/edit', null, 'application/x-bluetooth-on-off'); var adapter = tizen.bluetooth.getDefaultAdapter(); //Define a callback for the launchAppControl() method: document.getElementById('text').textContent = "1"; function launchSuccess() { console.log('Bluetooth Settings application is successfully launched.'); } function launchError(error) { alert('An error occurred: ' + error.name + '. Please enable Bluetooth through the Settings application.'); } //Define the reply callback of the application control which implements the ApplicationControlDataArrayReplyCallback (in mobile and wearable applications): var serviceReply = { /* Called when the launched application reports success */ onsuccess: function(data) { if (adapter.powered) { console.log('Bluetooth is successfully turned on.'); } else { console.log('Bluetooth is still switched off.'); } }, /* Called when launched application reports failure */ onfailure: function() { alert('Bluetooth Settings application reported failure.'); } }; document.getElementById('text').textContent = "2"; if (adapter.powered) { document.getElementById('text').textContent = "3"; console.log('Bluetooth is already enabled'); } else { console.log('Try to launch the Bluetooth Settings application.'); tizen.application.launchAppControl(bluetoothSwitchAppControl, null, launchSuccess, launchError, serviceReply); }