proposals icon indicating copy to clipboard operation
proposals copied to clipboard

WiFi

Open Ionitron opened this issue 5 years ago • 15 comments

Plugin Request

Name: WiFi Package: @capacitor-community/wifi

Platform(s)

Android, iOS

Existing Solutions

https://github.com/digaus/capacitor-wifi https://github.com/sushichop/cordova-plugin-wifi-manager https://github.com/tripflex/WifiWizard2

Description

  • Connecting to a network
  • Disconnecting from a network
  • Listing available networks

Ionitron avatar Jun 17 '20 20:06 Ionitron

Original request: https://github.com/ionic-team/capacitor/issues/1897

Ionitron avatar Jun 17 '20 20:06 Ionitron

What about this? https://github.com/ionic-team/ionic-native/tree/master/src/%40ionic-native/plugins/wifi-wizard-2

AE1NS avatar Aug 19 '20 08:08 AE1NS

@AE1NS I added it to the list of existing solutions, but these proposals are for Capacitor plugins, not Cordova plugins.

imhoffd avatar Aug 19 '20 18:08 imhoffd

Next one: https://github.com/digaus/capacitor-wifi Or better this fork with some more updates: https://github.com/HalleyAssist/capacitor-wifi

Install: npm i capacitor-wifi@git://github.com/HalleyAssist/capacitor-wifi.git

Update MainActivity.java in Android:

import com.digaus.capwifi.Wifi; <-- add

this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
    ...
    add(Wifi.class); <-- add
}});

Usage:

import { Plugins } from '@capacitor/core';
const { Wifi } = Plugins;
...
// i.e.
Wifi.connect({ ssid: 'My wifi network ssid' }).then(() => {
    console.log('connected');
});

AE1NS avatar Aug 24 '20 08:08 AE1NS

@digaus Any interest in joining the Capacitor community with your Wi-Fi plugin?

imhoffd avatar Aug 24 '20 17:08 imhoffd

@digaus Any interest in joining the Capacitor community with your Wi-Fi plugin?

It's basically copy paste from WifiWizard2

Also does not work sometimes on all Android version. Currently have no time and resources to look into that. :/

digaus avatar Aug 25 '20 06:08 digaus

@HalleyAssist you made some more commits in your fork, maybe its more stable?

AE1NS avatar Aug 25 '20 07:08 AE1NS

WifiWizard2 is Apache-2.0 licensed, which makes it difficult to create legal derivative works (I'm not a lawyer). The Capacitor community generally prefers the MIT license which is much more permissive.

imhoffd avatar Aug 25 '20 17:08 imhoffd

Hey everyone.

I am about to get back to my Wifi Plugin and do a rewrite with the newest version of capacitor.

Unfortunately I do only own the latest iOS / Android Versions. Is there someone willing to implement and test the parts for the older versions?

digaus avatar Sep 15 '20 16:09 digaus

Have started implementing:

https://github.com/digaus/community-capacitor-wifi

Already done are getIP() and getSSID() for iOS, Android and Electron (not 100% tested)

digaus avatar Sep 20 '20 22:09 digaus

Still working on this project?

sultanmyrza avatar Aug 18 '21 08:08 sultanmyrza

Still working on this project?

Yes but no official releases so far. It should work as is. Recently fixed some issues with iOS.

Just run npm install on my master and it should work.

digaus avatar Aug 18 '21 08:08 digaus

You can add your plugin to awesome-capacitor if that is useful please take time to star the repo :)

riderx avatar Nov 18 '21 02:11 riderx

@digaus plugin https://github.com/digaus/community-capacitor-wifi worked for our case.

sultanmyrza avatar Feb 19 '22 04:02 sultanmyrza