hoerresb / wifiwizard Goto Github PK
View Code? Open in Web Editor NEWA Cordova plugin for managing Wifi networks
License: Apache License 2.0
A Cordova plugin for managing Wifi networks
License: Apache License 2.0
Is it possible for .getScanResults
to include the used security protocol in the returned object? It would be nice if it can achieve this. An example returned object would be something similar to this:
{
BSSID: "...",
SSID: "...",
level: ...,
algorithm: "WPA"
}
@parsonsmatt 👍 this repo is quite helpful for various project, but... it is dead/abandoned?
Hey @parsonsmatt, I've been working on a few updates for the WifiWizard repo. Mostly small bugs that have been pointed out or are outstanding. It seems that cordova is moving the plugins to npm seen via http://cordova.apache.org/announcements/2015/04/21/plugins-release-and-move-to-npm.html.
It seems we have already taken care of this, but I was wondering if I could be added as a user. When I tried to update using npm publish ../pathToWifiWizard I was told I do not have permission to do so.
Username is hoerresb
There's no rush on this. Thanks.
Hi, does the plugin be suit for ios?
It seems that the plugin only for android.
Set wifi status. enabled is a Boolean type, so to disable the Wifi, you'd execute
WifiWizard.setWifiEnabled(false**,win,fail**);
Would save some Headache.
THX.
I don't have the spare time to continue maintaining this plugin. If anyone wants to take over as the full-time maintainer, let me know and I can work on transferring the important stuff to you.
"Currently, iOS only has limited functionality. Most functionality is only available on Android."
Can you spell out what does work on iOS? Even if it just gets a list of network SSID's that would be useful for our purposes (though signal strength would be even better).
Currently for IOS the getConnectedSSID works well. We need to get the BSSID of the connected network too. I believe apple supports this natively now.
https://developer.apple.com/library/prerelease/ios/documentation/NetworkExtension/Reference/NEHotspotHelperClassRef/index.html#//apple_ref/occ/cl/NEHotspotHelper
AND
https://developer.apple.com/library/prerelease/ios/documentation/NetworkExtension/Reference/NEHotspotNetworkClassRef/index.html#//apple_ref/swift/cl/c:objc(cs)NEHotspotNetwork
Is it possible to add this functionality into this pls?
Thanks.
I am using Cordova version 3.2.0 and I have enabled ACEESS_WIFI_STATE and CHANGE_WIFI_STATE permissions on android. But window.WifiWizard is not defined.
First thanks for a great plugin!
Here is my code:
var onSuccessConnectToNetwork = function (result) {
console.log(result);
};
var onFailConnectToNetwork = function (result) {
console.log(result);
};
WifiWizard.connectNetwork('mySSID', onSuccessConnectToNetwork, onFailConnectToNetwork);
If I disable my wireless access point, provide wrong credentials, it still says Network "mySSID" connected!
.
onFailConnectToNetwork
gets called only if I disable wireless connection on my phone.
Is it possible to get actual connection result?
Hi
My first project in mobile development, please forgive my ignorance for mobile development.
So far I have been using this plugin to connect a wifi device via an andriod phone.
I saw this below comment for the read me:
"iOS has limited functionality, as Apple's WifiManager equivalent is only available as a private API. Any app that used these features would not be allowed on the app store. The only function availabe for iOS is getCurrentSSID."
Does this mean at this stage I can't connect a wifi access point on ios using this plugin?
Are there any future plans to make this available?
Regards,
Savan
Multi-part issue:
Testing Cordova plugins is sufficiently difficult that automating the process somewhat needs to be done.
I would prefer to have this complete before any additional changes are made to the plugin.
Hi Matt,
it seems that wifiwizard 0.2.8 cannot be teched at the moment :
cordova plugin add com.pylonproducts.wifiwizard
Fetching plugin "com.pylonproducts.wifiwizard" via plugin registry
npm ERR! fetch failed http://cordova.iriscouch.com/registry/_design/app/_rewrite/com.pylonproducts.wifiwizard/-/com.pylonproducts.wifiwizard-0.2.8.tgz
npm ERR! fetch failed http://cordova.iriscouch.com/registry/_design/app/_rewrite/com.pylonproducts.wifiwizard/-/com.pylonproducts.wifiwizard-0.2.8.tgz
npm ERR! fetch failed http://cordova.iriscouch.com/registry/_design/app/_rewrite/com.pylonproducts.wifiwizard/-/com.pylonproducts.wifiwizard-0.2.8.tgz
Error: getaddrinfo ENOTFOUND
at errnoException (dns.js:37:11)
at Object.onanswer as oncomplete
Hi, I'm wondering how to enable the wifi hotspot for a user that has my app installed. Can it be done with this plugin?
(I'm new to this)
Thanks
It is possibile an example? thanks!
I have an issue : Uncaught ReferenceError: WifiWizard is not defined. I have already installed the plugin.xml file
I'm trying to connect to a new network and enter the WPA password but without success ... is possible to have a working code for this ?
I believe that the function to use are:
WifiWizard.formatWifiConfig(SSID, password, algorithm);
WifiWizard.formatWPAConfig(SSID, password);
WifiWizard.addNetwork(wifi, win, fail);
WifiWizard.connectNetwork(SSID, win, fail);
but how to use? Thanks a lot!
Hi Matt,
Thank you for a great plugin. I included it in my app and I used phonegap build to get the apk. The version included on build is old and lacks the latest api such as getScanResults. Do you think you can submit the latest version to https://build.phonegap.com/plugins ?
Thank you!
I use phonegap 5.3.7, and i added android, browser to platform. In my config.xml :
engine name="android" spec="~4.1.1"
engine name="browser" spec="~4.0.0"
but my phone is just 4.4.2.
Question:
In browser, I can get WifiWizard in browser (after execute: build browser, run browser), but got "Missing Command Error" in failed callback.
in android: it is undefined (run android, serve).
What is the problem?
The version of android is 4.1.1 at first, and i changed to 5.0.0 when i saw the issuse:
#48.
but still failed.
As far as I can tell the Android Wifimanager doesn't allow adding a network when the network is disabled.
The plugin method could enable wifi, add the network and then disable wifi again. Or just simply turn on wifi.
Currently one has to call startScan
and then poll getScanResults
until the scan is complete. It will be simpler if I could call waitForScanResult
(not a good function name, but nvm....) and have a callback called when an intent with SCAN_RESULTS_AVAILABLE_ACTION is sent. An example usage 😄 ..
BTW, 👍¹⁰⁰ for this package, it works great 😃
Can we get a license added to the project please?
It's listed as Apache 2.0 in the Cordova plugin registry, but not on github nor apparently anywhere in the code or readme.
Since cordova plugin add com.pylonproducts.wifiwizard
pulled 0.2.9
instead of the new 0.2.10
, I decided to install using the Master .git
URL. However this gives me a build error:
platforms/android/src/com/pylonproducts/wifiwizard/WifiWizard.java:275: error: package NetworkInfo does not exist
NetworkInfo.DetailedState connectionState = info.getDetailedStateOf(info.getSupplicantState());
Building against Android target version 22.
When I call getCurrentSSID
when I'm not connected to a network on Android, I get 0x
back. I would've expected either an error, an empty string, null, or undefined.
Hello again! With your update on the level value for the getScanResults method, it seems that the old level value always returns "0". Here is my code:
WifiWizard.getScanResults({numLevels:1}, function(result){
alert(result);
showScanned(parseScan(result));
});
The alert() show me this:
[{"level":0,"SSID":"fenelonsio","BSSID":"58:8d:09:e2:ad:ad"},{"level":0,"SSID":"OKLM","BSSID":"a2:80:f5:41:3f:0d"}]
Is it a bug in the plugin or did I do something wrong? Thanks!
Does this plugin fully support iphone devices?
I have installed and tested in iphone 5 its not working. Unable to get network list while device scanning.
Please advice if there is any solution. Thanks in advance.
Hi,
I need to use wifi scan functionality in ios,
Is there any plugin or work around,
Please help regarding this,
Thanks and Regards,
Murali
In the README it is written that there is a release of v0.2.9. But I cannot access it.
'cordova plugin add com.pylonproducts.wifiwizard' gets v0.2.8 and hence no latest fixes.
Hello,
how can I inject the plugin into my application config?
I would like to let the application to set the wifi password if it is installed.
I have this code on application configuration.
´´´
var happyApp = angular.module('happyApp', [
'ionic',
'ngRoute',
'happyControllers',
'pascalprecht.translate',
'ionic.utils',
'api'
]);
happyApp.config(function($stateProvider, $urlRouterProvider, $translateProvider){
if(window.localStorage['country_value']!=null && window.localStorage['store_number']!=null){
$urlRouterProvider.otherwise('/');
}else{
$urlRouterProvider.otherwise('/setup');
}
console.log("test"+WifiWizard.formatWPAConfig('DKT_3','Cp-Spain'));
$stateProvider.state('index', {
url: '/',
templateUrl: './views/faceIndex.html',
controller: 'faceIndexCtrl'
});
$stateProvider.state('setup', {
url: '/setup',
templateUrl: './views/setup.html',
controller: 'setupCtrl'
});
$stateProvider.state('logout', {
url: '/logout',
templateUrl: './views/logout.html',
controller: 'logoutCtrl'
});
$translateProvider
.useStaticFilesLoader({
prefix: 'translations/',
suffix: '.json'
})
.registerAvailableLanguageKeys(['en', 'es', 'de', 'fr', 'it'], {
'en-US': 'en',
'es-ES': 'es',
'de-DE': 'de',
'fr-FR': 'fr',
'it-IT': 'it',
});
$translateProvider.preferredLanguage(window.localStorage['country_value']);
$translateProvider.fallbackLanguage(window.localStorage['country_value']);
});
´´´
But when I start the application the console give me undefined error in image
Error: [$injector:unpr] Unknown provider: WifiWizard
Can you help me please?
isWifiEnabled is only set after the status of the wifi is retrieved, if I use addnetwork without first checking the active wifi connection it will incorrectly give me the information that wifi is not enabled
EDIT: never mind I found the fix. apparently I was using an older version of the plugin
The docs mention:
Currently, only WPA is supported for the algorithm value.
What does this mean in practice? Does this mean only networks with WPA authentication can be joined? What about WPA2, WPA-PSK, WPA Enterprise, WEP, or even open networks?
Hi,
The getBSSID() function returns incorrect bssids for some macaddresses.
Here's an example: the bssid of my network is:
Cirrent-personal a8:a6:68:d9:71:0b -31 11 Y -- WPA(PSK/AES,TKIP/TKIP) WPA2(PSK/AES,TKIP/TKIP)
But when i connect to it and call getCurrentBSSID() i get back a8:a6:68:d9:71:b
Notice the last bit - the actual bssid has a 0b
, and this just has b
. When i convert the hex to decimal the values are quite different. Do you think this is a quick fix?
Thanks a lot!
I'd like to migrate all of the WifiWizard
related repositories off of my account, since I'm not doing anything with them anymore and can't provide adequate maintenance. It's probably best to have them on a github organization rather than an individual account.
If someone would like to create the organization, I can assign the repositories to that organization. I can also create the organization and do the assignments myself, and then assign the organization ownership to the current maintainer if that's preferred.
I can run getCurrentSSID on a device with an app downloaded from Xcode. But I get "Not available" running the same code on a simulator. The device and the Mac running the simulator are connected to the same WiFi.
Targeting API level 23 on Android requires ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION to retrieve scan results
i've installed this plugin and try to use this method
WifiWizard.getCurrentSSID(function(success){
alert(success);
}, function(error){
alert(error);
});
But nothing happened.
Hi Team,
Thank you for your great plugin. I have tried to use this plugin but got struck with a minor glitch, would you be able to help me out. I posted it at stack but no one replied so thought of putting it here,
Here is the link to the problem at stack:
http://stackoverflow.com/questions/32629233/error-while-getting-wifi-network-information-ssid-in-phonegap-app-using-com-py?noredirect=1#comment53172329_32629233
Hey!
I like the plugin but the problem is that when i try to refresh the list. it refreshes like 1 time and stays the same the whole day. it doenst changes even when i change locations. like it caches the list.
Also the list is very incomplete. There are like 8 networks around me but it only shows 2 sometimes 4 and then 1
HI,
I want to run wifiwizard plugin in andriod background service,
Please help me in this regard,
BestRegards,
Murali
I can't get WifiWizard.getScanResults() to fire any of its callbacks. I have a scan running, and once the scan runs, I set an interval to retrieve results every 3s. However this never happens, while I can see that the interval does fire.
I am testing with Cordova 5.1.1 and version 0.2.9 (release branch) of your plug-in, on Android 4.1.1.
My code:
if(typeof WifiWizard !== 'undefined'){
WifiWizard.isWifiEnabled(function(wifiIsEnabled){
if(!wifiIsEnabled){
console.log('Wifi is off');
}else{
WifiWizard.listNetworks(function(previouslySelectedNetworks){
if(previouslySelectedNetworks.length>0){
console.log("A network was previously selected but not connected. Inform user why we're presenting the network list now.");
$scope.previouslySelectedNetworkExpired = true;
}
WifiWizard.startScan(function(){
console.log("Scanning for networks...");
$scope.scanResultsInterval = setInterval(function(){
console.log("Scan interval running.");
WifiWizard.getScanResults(function(availableNetworks){
$scope.networks = availableNetworks;
console.log("Updating network list with results." , availableNetworks)
}, function(){
console.log("Failed to get scan results.");
});
}, 3000);
},function(){
console.log('Failed to start WiFi scan.');
});
}, function(){
console.log('Failed to get a listing of previously selected networks.');
});
}
},function(){
});
}else{
console.log("No WifiWizard plugin loaded.");
}
Hi,
Both isWifiEnabled and setWifiEnabled are not working for iOS. I also saw that in iOS native code the isWifiEnabled function implementation is empty and setWifiEnabled implementation always return "not supported".
Are you planning to implement both these functionalities for iOS?
Thanks in advance
I just came across this IOS git project: https://github.com/mongizaidi/LAN-Scan
Does that have the logic to get the startScan, scanNetwork and listNetworks methods working?
When I call WifiWizard.connectNetwork()
, it fires the success
callback even if I add a random network that's not mine, with a random passphrase. Running 0.2.11
on Android 4.1.1
. My code:
if(typeof window.WifiWizard !== "undefined") {
WifiWizard.addNetwork(WifiWizard.formatWPAConfig(networkName, passPhrase), function(){
console.log("Added network '"+networkName+"' to the list of known networks.");
WifiWizard.connectNetwork(networkName, function(){
console.log("Connected to network '"+networkName+"'."); // Always logged
},function(err){
console.log("Failed to join network '"+networkName+"'.",err);
deferred.reject('notConnected');
});
}, function(err){
console.log("Failed to add network '"+networkName+"'.",err);
deferred.reject('errorAddingNetwork');
});
}else{
deferred.reject('Wifi Wizard plugin not available.');
}
I call formatWifiConfig to create the configuration, then addNetwork. I get:
Uncaught TypeError: Object # has no method 'trim' in WifiWizard.js on line 76.
Is this a known problem?
In android platform: there are a double quotes more in successParam. I think it may be a bug.
In IOS platform: It works fine.
Device Model: SproutChannelCubby
Android version: 4.4.2
Processor: QuadCore-A31
Phonegap Build verison: cli-5.2.0
ERROR: Build fails.
To be clear, I got 0.2.9
to work. It builds and runs on my tablet.
https://www.npmjs.com/package/com.pylonproducts.wifiwizard returns 404. This is preventing me from installing the latest version of wifiwizard and anything I try, I can only ever build my project with 0.1. AS you know, this does not include the full range of features.
Can you post your plugin to the address above so that Phonegap Build can access the latest version?
Hello!
I am trying to use your plugin but I encountered some problems. I successfully scanned for networks, but now I can't get to make isWifiEnabled to work. It always returns true, whether the WIFI is enabled or disabled. I am using Android 5.0.0, Cordova 4.2.0 and WifiWizard 0.2.8. Here is my code:
WifiWizard.isWifiEnabled(function(result){
alert(result);
});
So whether my WIFI is enabled or not, it shows me a big "true" on my screen. setWifiEnabled or getConnectedSSID also don't work. I may be using these methods in a wrong way, so I'd be glad if someone helped me if that's the case.
Still, thank you for your help!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.