Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotspot can not be connected to if it is password protected #19

Open
samansalamat opened this issue Nov 17, 2017 · 7 comments
Open

hotspot can not be connected to if it is password protected #19

samansalamat opened this issue Nov 17, 2017 · 7 comments

Comments

@samansalamat
Copy link

samansalamat commented Nov 17, 2017

Hi Nick,
The library works great but when I set a configuration for a WPA_PSK hotspot, the hotspot is created but it can't be connected on the other device.
Of course this is not your code's problem since I'v been dealing with this with any other solution. it is like the hotspot is created with a problem!
any ideas how to solve this problem?
PS: I'm making hotspot on android 7.1 and the client is running 5.1. and this only happens when I create hotspot on android 7+ devices.

@nickrussler
Copy link
Owner

What happens when you try to connect to the 7.1 device?
How do other devices see it(encryption, name, ...)?

@neemashahbazi
Copy link

Seems like they can not obtain IP, and it keeps trying again and again. and when this happens... SSID, password everything is all right, it is even authenticated but can't get IP.

@nickrussler
Copy link
Owner

nickrussler commented Nov 18, 2017

Can you try to compare the WifiConfiguration of a manually activated hotspot and the programmatically activated one? You could also try to to activate manually, save the WifiConfiguration, disable the AP and then enable it via API with the dumped WifiConfiguration. Check if that works. I would especially look at the ipAssignment field, maybe the problem ist DHCP related.

@neemashahbazi
Copy link

The "ipAssignment" field is "UNASSIGNED" in both ways.
This is the Manually Created Config:
Manually_Created_Config: * ID: -1 SSID: nBdRURzKwVNLnLGL t (7985) PROVIDER-NAME: null BSSID: null FQDN: null PRIO: 0 HIDDEN: false NetworkSelectionStatus NETWORK_SELECTION_ENABLED hasEverConnected: false KeyMgmt: NONE Protocols: AuthAlgorithms: PairwiseCiphers: GroupCiphers: PSK: sim_num Enterprise config: IP config: IP assignment: UNASSIGNED Proxy settings: UNASSIGNED cuid=-1 luid=-1 lcuid=0 userApproved=USER_UNSPECIFIED noInternetAccessExpected=false isCarrierNetwork=false roamingFailureBlackListTimeMilli: 1000 triggeredLow: 0 triggeredBad: 0 triggeredNotHigh: 0 ticksLow: 0 ticksBad: 0 ticksNotHigh: 0 triggeredJoin: 0

and this is the Programmatically created Config:
Programmatically_Created_Config: * ID: -1 SSID: nBdRURzKwVNLnLGL t (7985) PROVIDER-NAME: null BSSID: null FQDN: null PRIO: 0 HIDDEN: false NetworkSelectionStatus NETWORK_SELECTION_ENABLED hasEverConnected: false KeyMgmt: NONE Protocols: AuthAlgorithms: PairwiseCiphers: GroupCiphers: PSK: sim_num Enterprise config: IP config: IP assignment: UNASSIGNED Proxy settings: UNASSIGNED cuid=-1 luid=-1 lcuid=0 userApproved=USER_UNSPECIFIED noInternetAccessExpected=false isCarrierNetwork=false roamingFailureBlackListTimeMilli: 1000 triggeredLow: 0 triggeredBad: 0 triggeredNotHigh: 0 ticksLow: 0 ticksBad: 0 ticksNotHigh: 0 triggeredJoin: 0

I can't find any differences and it is certainly DHCP related. the thing is that apps like "Shareit" work fine and create hotspot and the client can connect easily while the code posted here or the ones I have tried are not working and it is not protected hotspot specific, the open ones also face the problem and get stuck on "Obtaining IP".
Any Ideas?

@TomislavHorvat1
Copy link

TomislavHorvat1 commented May 15, 2018

I have encountered the same problem, the other device connects only if you pause the activity (i.e. lock the phone). I have just added a hack after invoking the method to set the ap on, just paused and resumed the activity.

I tested this on both devices running Android 7 (the client and server). TCP doesn't work for some reason

@vikoo
Copy link

vikoo commented Jun 29, 2018

Hi Nick,
I also faced the same issues on Android 7.1 device where I am able to configure the hotspot but the client is not able to connect. It just stuck at "obtaining Ip address....". Any solution for this. I tried to set the hotspot manually from settings and then try to open AP and it's creating the hotspot but client is not able to obtain the IP address

@erotundo
Copy link

Hi @vikoo

I have the same issue, do you solve the problem? I tried create AP configuration into the code but the problem continuous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants