ThanosFisherman / WifiUtils

Easily Connect to WiFi Networks
Apache License 2.0
744 stars 188 forks source link

Feature: Add pattern match for Wifi name #112

Closed rlesniak closed 3 years ago

rlesniak commented 3 years ago

Description

Usage:

WifiUtils.withContext(context)
                .patternMatch()
                .connectWith(....

Now android Q+ will prompt about matching Wifi networks list. Example usage: I have USB dongle which emits its own WiFi and I need to connect with it without knowing its name, only first part of name, eg. RS-43144 where prefix is RS-

Closes #111

Solution

use setSsidPattern from API

ThanosFisherman commented 3 years ago

Hello and thanks for your contribution.

I'm currently trying to test the pattern matching by connecting to my network but it would fail. I will take a closer look and keep you posted.

rlesniak commented 3 years ago

@ThanosFisherman have you had a chance to run it? I really wish to have this feature soon :)

ThanosFisherman commented 3 years ago

Hi, @rlesniak yes I tried it last week but it wouldn't succeed.

To give you an example suppose my network's SSID is Thanos123 I tried various combos like Thanos, Tha etc but it wouldn't connect and would fail with a custom error log message.

I couldn't find time to investigate it further though. Hopefully I can give it a second look in the upcoming days.

Any ideas of what might be wrong? Does it work on your device?

rlesniak commented 3 years ago

I did small fix, check now, it should work. obraz

PS. I am not Java developer 😅 So this PR will require some refactor. Prefix with no password needs some rework :/ But for now it is working, and I really need that functionality in my app

rlesniak commented 3 years ago

@ThanosFisherman updated. Have you had a chance to test it?

ThanosFisherman commented 3 years ago

@rlesniak Thanks. It looks good now. I tested it and it seems to work fine even though it could use some refactoring in the future. For now I will just merge it as is and I will soon migrate this lib to maven central. Just keep an eye on Releases

Thanks for your contribution once again. :)