Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get bluetooth signal strength

Tags:

java

android

I want to get the Bluetooth signal strength of an another device which connected to my phone,

How can I get the Bluetooth signal strength?

I tried to search a lot over google and did not find any answer.

Does someone know how can I implement it?

this is myActivity:

public class MainActivity extends Activity {      @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);         registerReceiver(receiver, new IntentFilter(BluetoothDevice.ACTION_FOUND));       }      @Override     public boolean onCreateOptionsMenu(Menu menu) {         // Inflate the menu; this adds items to the action bar if it is present.         getMenuInflater().inflate(R.menu.main, menu);         return true;     }      private final BroadcastReceiver receiver = new BroadcastReceiver(){         @Override         public void onReceive(Context context, Intent intent) {              String action = intent.getAction();             if(BluetoothDevice.ACTION_FOUND.equals(action)) {                 int rssi = intent.getShortExtra(BluetoothDevice.EXTRA_RSSI,Short.MIN_VALUE);                 Toast.makeText(getApplicationContext(),"  RSSI: " + rssi + "dBm", Toast.LENGTH_SHORT).show();             }         }     };  } 

I also has a Bluetooth permission in my manifest file.

like image 915
Idan Rahamim Avatar asked Mar 09 '13 16:03

Idan Rahamim


People also ask

Can you test Bluetooth signal strength?

You can certainly test your device's Bluetooth strength. It is best practice to troubleshoot your devices in a time efficient way. Use a test device to run a full diagnostic test to ensure your device is operating perfectly. Next begin looking at outside factors that may be interfering with your signal.

How can I get Bluetooth signal strength in Android?

To get the signal you can check Bluetooth RSSI, you can read RSSI for connected devices, or perform a Bluetooth discovery to check the RSSI for any nearby devices. Basically a Bluetooth discovery is a broadcast to all stations within range to respond back.

How do I find my Bluetooth frequency?

Bluetooth doesn't have one particular frequency it operates on. Via bluetooth.com: Bluetooth technology operates in the unlicensed industrial, scientific and medical (ISM) band at 2.4 to 2.485 GHz, using a spread spectrum, frequency hopping, full-duplex signal at a nominal rate of 1600 hops/sec.

How do I check the signal strength of my Iphone Bluetooth?

With the system preferences open, hold the Option key and a small bar graph with an RSSI number should appear that shows the signal strength. At the bottom of the Bluetooth system preferences there is a small gear menu that contains an option to "Monitor Connection RSSI" for any connected Bluetooth device.


1 Answers

To get the signal you can check Bluetooth RSSI, you can read RSSI for connected devices, or perform a Bluetooth discovery to check the RSSI for any nearby devices.

Basically a Bluetooth discovery is a broadcast to all stations within range to respond back. As each devices responds back, Android fires off an ACTION_FOUND intent. Within this intent you can getExtra EXTRA_RSSI to obtain the RSSI.

Note that not all bluetooth hardware supports RSSI.

Also Related: Android IRC Office Hours Question About Android Bluetooth RSSI here is a Bluetooth Classic broadcast receiver example

private final BroadcastReceiver receiver = new BroadcastReceiver(){     @Override     public void onReceive(Context context, Intent intent) {          String action = intent.getAction();         if(BluetoothDevice.ACTION_FOUND.equals(action)) {             int  rssi = intent.getShortExtra(BluetoothDevice.EXTRA_RSSI,Short.MIN_VALUE);             Toast.makeText(getApplicationContext(),"  RSSI: " + rssi + "dBm", Toast.LENGTH_SHORT).show();         }     } }; 
like image 152
Arvind Avatar answered Oct 12 '22 23:10

Arvind