0

I am implementing an APP through Xamarin.

The APP need to check a password for an SSId is right or not.

So I issued a wifi connection to check it.

Here is the code.

var specifier = new WifiNetworkSpecifier.Builder()
    .SetSsid("Target_SSID")
    .SetWpa2Passphrase("Target_Password")
    .SetBssid(MacAddress.FromString("Target_Mac"))
    .Build();
var request = new NetworkRequest.Builder()
    .AddTransportType(TransportType.Wifi)
    .SetNetworkSpecifier(specifier)
    .Build();
var callback = new NetworkCallback
{
    NetworkAvailable = network =>
    {
        // we are connected!
    }
};
ConnectivityManager connectivityManager = (ConnectivityManager)Android.App.Application.Context.GetSystemService(Context.ConnectivityService);
connectivityManager.RequestNetwork(request, callback);

But what I found out is.

If the mobile didn't connected to the SSID before. Then this works fine.

BUT if the mobile phone has a connected record in it's system.

Even The APP passed a WRONG password. After execute this code.

The mobile phone still connect to the SSID successfully.

Why?

This make me not able to confirm the password is right or not.

CC.Wang
  • 111
  • 1
  • 12
  • It seems that app have save password when you connect to wifi firstly, so it will connected wifi again don't use password. – Cherry Bu - MSFT May 14 '21 at 05:30
  • @CherryBu-MSFT Yes. According to my try. If user once connect to an SSID by itself. When app use another password try to connect to same SSID. The password provided by app will be ignored. – CC.Wang Jun 09 '21 at 02:03

0 Answers0