This is a simple app to implement a Simple WiFi Application with functionality using IONIC Framework on the top of Phonegap/Cordova. This application is designed for Iphone, Android and Windows Phone but can also be deployed as Blackberry Application. I name it as WiFiApp targetting the management of WiFi and their connectivity.
Setting Up the Project
Installation Required:- Node JS for NPM Packages
- Cordova
- IONIC Framework
- Android SDK (for the deployment to the Device/Emulator)
- IOS (you need a MAC for the deployment to the Device/Emulator)
- And the involvement of Third Party Plugin "WiFi Wizard"
Create Project Directory
Here's a link to the Github Repository WifiApp. You can either download a zip or simply clone it with Git Bash.
git clone https://github.com/DynamicRemo/WifiApp.git
Plugin Installation
cd IonicAppCRUD
After the navigation to the Project Directory, we can run our project with ionic serve command and the output will be displayed in the Browser.
cordova plugin add com.pylonproducts.wifiwizard
Once the plugin is added to our application, we are good to test and deploy.
Platform, Build and Deploy
ionic serve
Or we can have the App View just like the Mock Ups for IOS and Android, its a new cool feature by IONIC.
ionic serve --lab
Moreover, we can add IOS and Android Platform to our Project and can directly deploy to our Device.
ionic platform add android ionic platform add ios
ionic run android ionic run ios
Application Overview
Followings are the different views of Application: Searching for WiFi, Detected WiFi(s) and the success message for the Connection.
For feedbacks and discussion, please leave a comment. Thank You!
This comment has been removed by the author.
ReplyDeleteexcellent app to understand the wifi functionality but my requirement is to click wifi available and connect to it by providing password.
ReplyDeleteYes, this App is performing your desired functionality.
DeleteIn this simple App you can connect to any listed WiFi(that is not Password protected).
it does not perform amit's desired functionality
Deletecan you please elaborate the requirement you are expecting? then I can surely have a look and add a functionality.
DeleteHey i was looking for plugin for wifi then i found this. But you are using angular gs.But recently i want to develop an app using cross platform. But i am using Visual studio and cordova. So how i can have wifi plugin for visual studio and cordova in order to use the functionality of wifi.
ReplyDeleteyou can use any cordova supported plugin, the only variation is to how you add the plugin, either you can add this "WifiWizard" Plugin or if you have find any other suitable one.
DeleteThis comment has been removed by the author.
DeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHi Remo !
ReplyDeleteFirst, thanks a lot for your Ionic App.
I try to add 1 function to the wifiservice.js file which is WifiWizard.setWifiEnabled. What I want is when the app is starting, if the Wifi is disabled on the phone, the app sets WiFi enabled. Unfortunately, when I run the app, and if the WiFi is disabled, I have directly the error message "Wifi is not enabled.".
What I did:
wifiservice.js
function startWifi(param){
WifiWizard.setWifiEnabled(param,win_wifi,fail_wifi)
}
app.js (just after $scope.wifiList = []; ):
$scope.startWifi = function(enabled){
WifiService.startWifi(enabled);
alert("startWifi");
}
Thank you.
I got your concern, the thing is Cordova/Phonegap apps need some extra milliseconds to get ready while you are using some third party plugins just like "WifiWizard". That's the reason why as soon as app starts your variable $scope.startWifi tries to get initialized before even the plugin is ready.
DeleteA simple hack is to delay your initialization by some seconds using the cool circular slider and you will be good to go. Cheers :)
This comment has been removed by the author.
ReplyDeleteHi, I'm having trouble setting this up - asked you on github and you closed the issue - if you can help me I'd be more than willing to pay you for your time, thanks.
ReplyDelete@Muhan95 please have a look at the repository, i just pushed Node Modules, Plugin and Platform Folder for you. Sorry for the late response.
DeleteHope this will help you out, Cheers ;)
HI, great tutorial. I followed all your steps and even downloaded the demo zip from your git page. The wifi networks are found without issues but when I click on a network ( open network, no password) . I get the following error |: WifiWizard cannot connect to network. What could be the issue ?
ReplyDeleteThank you for the feedback.
DeleteHenry, I just tested the application on my device and it works fine. Moreover, Please make sure, that the wifi which you are connecting to, is connecting directly from the Native Wifi Setting with a single click or you have already provide credentials via the Phone Setting.
As this is a simple application that connects only to those network which are open and dont need any authentication or any proxy setting. Cheers ;)
Hi Dynamic Remo, thanks alot for the feed back.Just one clarification: i noticed that if i have already connected to the open network on the phone's native wifi settings then navigate to your mobile app and select the same network, it returns a success; but if i simply navigate to your application and attempt to connect to the same wifi without connecting it first on the native application, it returns an error. Should this be so ?
Deletethat's strange, may be I need to review the application or some appropriate function (from the plugin) for this.
DeleteThis comment has been removed by the author.
ReplyDeleteIs there anyway to include a button to enable wifi on and off, please give a suggestion. Im trying to build it as a normal wifi-configuration as in our smart phones. Help me!
ReplyDeleteNo, the plugin which I have used in this tutorial doesn't provide any such function to Turn On/Off Wifi. I believe there must be some other plugin out there for Phonegap/Cordova that will fulfill you need. Cheers!
Deleteokay, is there anyway to connect to a particular network once we get the wifilist and if so what is the procedure or the function I have to write.
Deleteit can be performed with almost the same function which is invoking the click event on List Items. You have to pass the particular SSID for that Wifi.
DeleteAdditionally, you have to wait for few seconds and let the plugin come along with the flow of application.
All the best, cheers!
This comment has been removed by the author.
ReplyDeleteI have two primary questions,
ReplyDeletefirst: the pluguin is only for android? I would love it compiled in ios ...
second: the method disconnect could not make it work, could you give me a hand ...
thank you
first: WifiWizard's latest release also support IOS
Deletesecond: please post your code here and we all can have a look at your approach of handling that.
cheers!
is there a support for getScanResult also in IOS ?
DeleteI see the below in the IOS src
(void)getScanResults:(CDVInvokedUrlCommand*)command {
CDVPluginResult *pluginResult = nil;
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Not supported"];
[self.commandDelegate sendPluginResult:pluginResult
callbackId:command.callbackId];
}
HI,
ReplyDeleteI would like to use same plugin WifiWizard for Ionic2/Angular2,
Could you please tell me how can I inject it in ts code "type script", so I can use this method: WifiWizard.getConnectedSSID().
Thank you
Hi, I recently thought in the same direction. May be you can wait a bit and I will have that one also as a tutorial :)
DeleteThank you Remo
DeleteHello,
DeleteIs there a WifiWizard release for Angular2/ionic2 app using cordova / Android platform
Thank you
Hey Remo,
ReplyDeleteDownloaded the App and tried to get it to run on my iphone. I got the alert pop up saying 'index.html' Network Failure: Not supported.
When I try running it locally on the mac in the browser I get:
"wifiservice.js:46 Uncaught ReferenceError: WifiWizard is not defined(anonymous function) @ wifiservice.js:46"
Would appreciate any help you could give. Not managed to work out what is causing the issue.
Thanks
Hi, please follow the steps under the heading of "Setting Up the Project" and "Adding Plugin: WiFiWizard".
DeleteMoreover, for IOS you need to have the latest version of the Wifiwizard Plugin as the previous versions were only supported for Android.
Hope this helps, Cheers!
Hello,
Deletei facing same issue... please help me...
Thanks,
I have the same problem. Do we have to inject WifiWizard as a dependency?
DeleteIf so, how do we do the dependency injection?
Deletehi thanks for this great tutorial, my problem is i downloaded the GitHub files to my machine but when i try to run it i get this error "WifiWizard is not defined" please can you tell me the problem is.Thanks.
ReplyDeleteHi, as Githun repository only contains the skeleton for the Application and you have to explicityly install the plugin. Please follow the steps under the heading of "Setting Up the Project" and "Adding Plugin: WiFiWizard".
DeleteCheers!
I get the same error "ReferenceError: WifiWizard is not defined" where the code refers to WifiWizard.startScan()
DeleteI have followed the steps exactly as you have mentioned above. I am new to Ionic and Cordova. Is there something else I need to do? Please help.
Thanks.
It works now! Thanks for this app
Delete@DesiAmma: Can you please explain the steps that helped you solve this problem.
DeleteThis comment has been removed by the author.
ReplyDeleteHi, is the code need to be updated? In my android, it is always searching, (loading icon)? I could not find any wifi.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteNot detect any network , is kept looking , what I can do?
ReplyDeleteMany thanks for your sharing.
ReplyDeleteTag: router wifi buffalo
Shouldn't you inject "WiffiWizzard" in the WifiService?
ReplyDeleteThanks!
When i run on marshmallow it show me this error .. Network Failure: Need ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission to get scan results ...
ReplyDeleteThanks ...!
Hi. Does anyome could make it usin ionic 2?
ReplyDeleteThanks for the tutorial. I'm new and trying to learn how to do this... but I'm confused... I followed the steps exactly as above and I get: "ReferenceError: WifiWizard is not defined[Learn More]". Is see others are having trouble as well. What am I misssing?
ReplyDeleteI have added the plugin as mentioned in the above steps. But still shows the error as Uncaught ReferenceError: WifiWizard is not defined at wifiservice.js:46
ReplyDeleteDid anyone used this plugin in ionic2?
ReplyDeleteIt works for me on ionic2 but I need to do a few updates:
ReplyDelete- cordova platform update android. It use version 4 and need >= 5.
- cordova plugin add wifiwizard. The plugin of the tutorial is a legacy version from phonegap.
- npm install. Cordova throw me and error about this, I don't know exactly why.
cordova run android --device didn't work but run button in android studio yes. Build your apk and bingo!.