capacitor-community / proposals

Plugin and platform requests ✋
75 stars 2 forks source link

WiFi #9

Open Ionitron opened 4 years ago

Ionitron commented 4 years ago

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

Ionitron commented 4 years ago

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

AE1NS commented 4 years ago

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

imhoffd commented 4 years ago

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

AE1NS commented 4 years ago

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');
});
imhoffd commented 4 years ago

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

digaus commented 4 years ago

@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. :/

AE1NS commented 4 years ago

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

imhoffd commented 4 years ago

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.

digaus commented 4 years ago

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 commented 4 years ago

Have started implementing:

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

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

sultanmyrza commented 3 years ago

Still working on this project?

digaus commented 3 years ago

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.

riderx commented 2 years ago

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

sultanmyrza commented 2 years ago

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