userInThisWorld
userInThisWorld

Reputation: 1391

Android Wi-Fi Direct read rssi signal strength

I need to measure Wi-Fi Direct signal(RSSI signal) between two Android mobile phones. How i can do that?

Upvotes: 13

Views: 4608

Answers (2)

10101010
10101010

Reputation: 635

Create a Broadcast Receiver class inside your activity class that performs some action (display some message/ store in a variable) when RSSI's strength changes. This can be done as follows :

public class myReceiver extends BroadcastReceiver
{
    @Override
    public void onReceive(Context context, Intent intent)
    {
        String myAction = intent.getAction();
        if (myAction.equals(WifiManager.RSSI_CHANGED_ACTION))
        {
            manageNewRssi(intent.getIntExtra(WifiManager.EXTRA_NEW_RSSI,0));
        }
    }
}

manageNewRssi is a method that you have to define which does the required task.

Upvotes: 0

npal
npal

Reputation: 539

Until the current version of Android (v4.2.2 r1), the RSSI for WiFi Direct is hard coded.

Link

Upvotes: 1

Related Questions