javascript - Get Bluetooth status on Tizen Wearable -


i'm creating watch face gear 2 neo (using tizen wearable sdk), , i've spent hours looking (with no luck) way determine if bluetooth enabled or not (and if possible if it's connected).

i've tried looking @ tizen.systeminfo api documents, can't find anything. i've tried tizen.systeminfo.getpropertyvalue(); "bluetooth" / "network" property name, doesn't work. seems tizen.bluetooth namespace isn't usable either.

i know there must way, have seen several watch faces out there able status.

is able me out / point me in right direction?

edit:

using tizen.bluetooth.getdefaultadapter(); returns following: "the application not have privilege call method"

yes, possible.

to bluetooth status, need first defaultadapter using following api

var blueadapter = tizen.bluetooth.getdefaultadapter(); console.log(blueadapter); // log object        /* output of above log           bluetoothadapter           address: ""           name: ""           powered: false           visible: true        */  if (blueadapter.powered) {     // bluetooth on, can off using     blueadapter.setpowered(false); } else {     // bluetooth off, can switch on using     blueadapter.setpowered(true); } 

don't forget add privilege in config.xml of app.

<tizen:privilege name="http://tizen.org/privilege/bluetooth.gap"/> 

note: whenever try use platform, need provide corresponding privilege in apps config.xml file


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -