Subscription preference

Notification emails are sent to your Samsung account email address.

* Email : anonymous@samsung.com

  

Close

Bluetooth. Who knows how to manage it? Turn ON\OFF (Signature error -14, privileges)

Forums View
Started by Developer ivasyshyn.serzh , 4250 Seed Dec 07, 2017 23:49 Replies : 1 View : 767 Likes : 0
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"/>
"Signature error -14" appears when Tizen ver is 2.4. Anyways it doesn't work if the ver is 3.0. The code breaks down at the line "var adapter = tizen.bluetooth.getDefaultAdapter();"
Also I can not set 3.0 Tizen in the Tizen Studio, I set it manually in the config.xml Source tab.
Tizen Studio 2.0
I'm struggling to manage a button which sets ON\OFF Bluetooth via AppControl or without the setting menu. 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();

  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.');
  }

  var serviceReply = {
  onsuccess: function(data) {
      if (adapter.powered) {
          console.log('Bluetooth is successfully turned on.');
      } else {
          console.log('Bluetooth is still switched off.');
      }
  },
  onfailure: function() {
      alert('Bluetooth Settings application reported failure.');
      }
  };

  if (adapter.powered) {
    console.log('Bluetooth is already enabled');
} else {
    console.log('Try to launch the Bluetooth Settings application.');
    tizen.application.launchAppControl(bluetoothSwitchAppControl, null, launchSuccess, launchError, serviceReply);
}
Tags

Bluetooth , api , gears3 , turn

Post Reply
Board View
Samsung Developer iqbal.sublime , 35020 Seed Dec 13, 2017 08:46 Post #1 0
You may find helpful replies here developer.tizen.org/forums/web-application-development/bluetooth.-who-knows-how-manage-it-turn-onoff-signature-error-14-privileges
Post Reply