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

When connecting to local network, cannot send HTTPS requests after loading the app with #26

Open
Audrey-Ann opened this issue Oct 16, 2023 · 5 comments

Comments

@Audrey-Ann
Copy link

Hi again!

When using

"@react-native-tethering/wifi": "^1.0.0",

I am having issues when connecting to a local network using connectToLocalNetwork while testing on Android 13:

  1. Connecting the first time works and I am able to make requests to the network's private API no problem
  2. When I kill the app (close completely) and reopen the app, although my device is still connected to the local network, the api returns a "Network Error" status.
  3. It only works again if for a re-connect using connectToLocalNetwork

Then I was thinking I should disconnect to the local network before reconnecting, but:

  • When I try to disconnect in order to reconnect after using disconnectFromLocalNetwork, it returns a NetworkCallback was not registered error.

Would you have an explanation / reasons for the above issues please?

Thanks in advance. Let me know if you need more information!

@aboozaid
Copy link
Owner

As I know using connectToLocalNetwork will cause the network to be disconnected once the app killed unless that network are saved to device's network list or suggested before using connectToNetwork.

Did you call connectToLocalNetwork before calling disconnectFromLocalNetwork?

@Audrey-Ann
Copy link
Author

Audrey-Ann commented Oct 18, 2023

Thanks for your reply!

Yes I did.. but I will make further tests to fully confirm it.

Furthermore, are you suggesting I shall call disconnectFromLocalNetwork method before connectToLocalNetwork?

Thank you!

@Audrey-Ann
Copy link
Author

Another question.. should I use connectToNetwork if I want to connect to a local network that has internet and is not hidden? Apologies if that should be a straight forward answer..

@aboozaid
Copy link
Owner

Thanks for your reply!

Yes I did.. but I will make further tests to fully confirm it.

Furthermore, are you suggesting I shall call disconnectFromLocalNetwork method before connectToLocalNetwork?

Thank you!

Yes

@aboozaid
Copy link
Owner

Another question.. should I use connectToNetwork if I want to connect to a local network that has internet and is not hidden? Apologies if that should be a straight forward answer..

Depends on what you're looking for but in a case where you need to connect to a network with internet connection you may use both connectToNetwork and openWifiSettings together when a popup displayed user will only have to select that network without typing credentials

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

2 participants