语言

Menu
Sites
Language
Checking for Bluetooth status!

I'm develping a Gear Fit 2 app.

I'm using the follwing code to check whether bluetooth is on/off. However, it is not working!

Any idea if there is any compatibility issues between this code and Gear Fit 2?

 

var adapter = tizen.bluetooth.getDefaultAdapter();
       
      if ( adapter.powered ){ 
      
        alert("Bluetooth is turned on!");
	} 
        else 
        {
         alert("Bluetooth is turned off!");
        }

Thanks!

响应

1 回复
Iqbal Hossain

hi, try this

var adapter = tizen.bluetooth.getDefaultAdapter();
console.log("Bluetooth state: " + (adapter.powered ? "On" : "Off"));

also add the privileges.