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

Add support for API level 29 #104

Merged

Conversation

ViggoChavine
Copy link

Description of the Change

  1. Java: adds support for API level 29 released with Android 10. Uses WifiNetworkSpecifier.Builder to establish a connection, and ConnectivityManager.unregisterNetworkCallback when disconnecting

  2. Javascript: does not add double apostrophe when Android platform 10 or above because the new method for connecting does not support it

Benefits

Able to use the plugin on Android devices having API level 29 or higher

Possible Drawbacks

According to our tests none. Changes are only applied for API version 29 and higher

@arsenal942
Copy link
Collaborator

Looks good to me!

Copy link
Collaborator

@arsenal942 arsenal942 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Collaborator

@arsenal942 arsenal942 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove all the random spaces

src/android/wifiwizard2/WifiWizard2.java Outdated Show resolved Hide resolved
src/android/wifiwizard2/WifiWizard2.java Outdated Show resolved Hide resolved
src/android/wifiwizard2/WifiWizard2.java Outdated Show resolved Hide resolved
@ViggoChavine ViggoChavine force-pushed the issue/connectivity-android-10-and-q branch from d803f8f to ac1efbf Compare June 12, 2020 11:38
@ViggoChavine ViggoChavine requested a review from arsenal942 June 12, 2020 12:27
@ViggoChavine ViggoChavine force-pushed the issue/connectivity-android-10-and-q branch from f0fa119 to f01ee4c Compare June 12, 2020 12:30
@ViggoChavine
Copy link
Author

Remove all the random spaces

I have amended space removal fix into the existing commit to keep the history clean

@ViggoChavine ViggoChavine force-pushed the issue/connectivity-android-10-and-q branch from f01ee4c to e617350 Compare June 12, 2020 12:35
@danielehrhardt
Copy link

Please merge

Copy link
Owner

@tripflex tripflex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, I haven't been able to test myself but if others report this works I think it should be good to go

@danielehrhardt
Copy link

Looks good to me, I haven't been able to test myself but if others report this works I think it should be good to go

I tested on my Devices. Looks fine.

@ducker
Copy link

ducker commented Aug 6, 2020

From this conversation I assume that PR is ready to merge and is waiting almost month to do it. Could you review and merge the changes as it is quite important feature to support latest android version?

@favalex
Copy link

favalex commented Aug 10, 2020

I'm very new to android development, so take this with a pinch of salt. I've noticed that in many places API 29 will keep using wifiManager.getConfiguredNetworks() and that will always return an empty list according to documentation: https://developer.android.com/reference/android/net/wifi/WifiManager#getConfiguredNetworks()

This is causing many places to malfunction. For example mapping of SSID to network id doesn't work at all.

I can give you more details, in case you confirm that this is indeed a problem and not just me badly misunderstanding the code.

@eliadAfeka
Copy link

is there any news with this PR ? in November 2020 will no longer have the option to use this plugin without this PR.

@markarupert
Copy link

Does this fix work for anyone? I tried connecting to my network (in this case a wifi enabled device that is not on the internet) and a box pops up like it is trying to ask me if I want to connect to it but nothing is in the list.

Is there anyway for this to happen in the background, or have the user give it permission to connect without asking the next time?

@VijayVaveHealth
Copy link

@markarupert unfortunately no way to get rid of the box, please take a look at this https://blog.ostebaronen.dk/2019/11/android-10-wifi.html

If you are looking at connecting to an iOT device with no internet i have a forked version of ViggoChavine's branch that adds that support, please look at that.

@saoron
Copy link
Contributor

saoron commented Sep 25, 2020

@VijayVaveHealth what's the changes you made that are specific for internetless IOT?

@VijayVaveHealth
Copy link

VijayVaveHealth commented Oct 1, 2020

@saoron this is what i have in my network request builder

NetworkRequest.Builder networkRequestBuilder1 = new NetworkRequest.Builder(); networkRequestBuilder1.addTransportType(NetworkCapabilities.TRANSPORT_WIFI); networkRequestBuilder1.removeCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET); networkRequestBuilder1.addCapability(NetworkCapabilities.NET_CAPABILITY_TRUSTED); networkRequestBuilder1.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED); networkRequestBuilder1.removeCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED); networkRequestBuilder1.removeCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN); networkRequestBuilder1.removeCapability(NetworkCapabilities.NET_CAPABILITY_FOREGROUND); networkRequestBuilder1.removeCapability(NetworkCapabilities.NET_CAPABILITY_NOT_CONGESTED); networkRequestBuilder1.removeCapability(NetworkCapabilities.NET_CAPABILITY_NOT_SUSPENDED); networkRequestBuilder1.removeCapability(NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING); networkRequestBuilder1.setNetworkSpecifier(wifiNetworkSpecifier);

@mrelis
Copy link

mrelis commented Oct 7, 2020

Pending reviewer @arsenal942, please review & approve :-)

@glenngr
Copy link

glenngr commented Oct 7, 2020

Looks like @arsenal942 first approved, but then reset the vote because some changes were requested.

@tripflex are you able to remove @arsenal942 as a reviewer, ping him to approve, or force approve this PR?

@Rytiggy
Copy link

Rytiggy commented Oct 16, 2020

  • I was able to get this to work by removing tripflex current release version from my app:
    cordova plugin remove wifiwizard2
  • Then I added VijayVaveHealth fork which has both the IOT device and Android SDK 29 fixes In it
    cordova plugin add https://github.com/VijayVaveHealth/wifiwizard2#fa2548db3082a87e1411055571994fa7ecd60fb0

After that my app worked as expected with android sdk 29+.

@tripflex
Copy link
Owner

Sorry guys, so little time to work on this stuff, merging!

@tripflex tripflex merged commit 78efe4d into tripflex:master Oct 16, 2020
@Fred-Reis
Copy link

Fred-Reis commented Dec 2, 2020

#104 (comment)

works fine for me

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

Successfully merging this pull request may close these issues.