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

Connect to wifi without internet programmatically #36

Closed
4 of 7 tasks
mknnaren opened this issue May 22, 2018 · 8 comments
Closed
4 of 7 tasks

Connect to wifi without internet programmatically #36

mknnaren opened this issue May 22, 2018 · 8 comments

Comments

@mknnaren
Copy link

Prerequisites

Check all boxes if you have done the following:

Issue type

Select all that apply

  • Bug
  • Enhancement
  • Task
  • Question
  • Other

Description

Cannot communicate with the IOT appliance after a successful WiFi connection via Cordova app due to non availability of internet on the appliance.

Steps to Reproduce

  1. Connect to any WiFi router or IOT appliance which doesn't have internet connection.
  2. Try to communicate with appliance/router's web server.
  3. Android OS blocks all the API calls going through this connection.
  4. There is no prompt as well asking for "This network has no internet access. Stay connected? NO/YES".

Expected behavior: [What you expect to happen]

  1. Either the OS should let through the API calls to communicate with appliance/router.
  2. Or there should be a prompt asking the user to Stay connected or not.

Actual behavior: [What actually happens]

  1. I am able to connect to appliance's WiFi (soft AP) using your plugin.
  2. But I am not able to communicate with the appliance web server as the Android OS blocks all API calls and connections. This happens due to there is no internet connection on the appliance and the user has to be shown a prompt asking him whether to stay connected(YES/NO).
  3. This prompt doesn't show up as we are connecting to the WiFI via Cordova app.

Reproduces how often: [What percentage of the time does it reproduce?]
All the time it can be reproduced but only on Android OS version 8.1 and 7.1.2.

Versions

Plugin version: wifiwizard2@2.1.0
Android OS version: Oreo@8.1 and Noughat@7.1.2

Please include the plugin version that you are using and also include the OS, version and device you are using.

Additional Information

If we connect to the appliance WiFi (without internet) via WiFi settings of the Android OS, the prompt shows up. But when we connect to it from Cordova app the prompt doesn't show up.
Until we click on YES on the prompt (shown in the screenshot) the OS doesn't allow any communication to go through.

I am copy pasting a link where this issue has been solved in native code layer. Could you please look at it and include a fix for this.
https://stackoverflow.com/questions/40752991/connect-to-wifi-without-internet-programmatically

Any additional information, configuration or data that might be necessary to reproduce the issue.
1
2

@mknnaren mknnaren closed this as completed Jun 4, 2018
@anton-christensen
Copy link

@mknnaren I have this issue, did you resolve it somehow?

@angelofan
Copy link

Why connect to a networkless wifi? Isn't the device going to communicate with the remote server? Or are you going to use the local server as the master of the control device? Most people won't connect to a networkless wifi.

@tripflex
Copy link
Owner

@anton-christensen @13546777510 Many reasons, specifically an IoT device that needs to be setup to connect to actual wifi may create its own AP to set it up.

Make sure you're using the latest version from github (how to do so is in readme), and make sure to use bindall feature spefifically for android

@angelofan
Copy link

@tripflex Sounds like it is really useful. The method of using it is different for different users.
Everything will be perfect. good luck!

@mknnaren
Copy link
Author

@anton-christensen
Just make sure the mobile data is off and the API will go through. This issue was specific to Android OS version 7.1.2 so I ignored it due to small user base.

Anyhow this issue will still occur if your mobile data (4G) is on. As Android OS automatically decides if WiFi doesn't have internet then redirect all calls to the mobile data.
I did a workaround fix by checking if mobile data is on. If it is on then ask the user to turn it off to proceed further.

I hope this workaround fix comes to use for your case.

@tripflex
Copy link
Owner

@mknnaren that's specifically what the bindall feature is for, to force all data from your app to go through wifi even when no internet and even when mobile data is enabled

@mknnaren
Copy link
Author

@tripflex
Ohhhh :P I don't know how I missed this in the documentation. Thanks a lot for the info. I will make changes in the code asap.
Just a small request if you could add the text 'even when mobile data is on' in the documentation as well.

Thank you :)

@LukeBrandon
Copy link

@mknnaren did you find a solution. I am struggling with the same thing.

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

5 participants