java - WPS PIn and Push Android Lollypop 5.0 -
i trying write code wps pin , push method android lollypop. code compiles correctly configuration not initiated station when invoked. not sure doing wrong. piece of code snippet below:
wpsinfo getwpsconfig(){ wpsinfo config=new wpsinfo(); config.setup=wpsinfo.pbc; config.setup=wpsinfo.display; config.setup=wpsinfo.invalid; return config; }
i tried this:
wpsinfo wpsmanager = new wpsinfo(); if(cmdparams[0].equalsignorecase("pbc")){ wpsmanager.setup=wpsinfo.pbc; int wpsstatus = wpsmanager.describecontents(); log.i(tag,"status of device is:"+wpsstatus); system.out.println("status of device is:\"+wpsstatus"); return cmdexecstatus.success; } else if (cmdparams[0].equalsignorecase("pin")){ wpsmanager.setup= wpsinfo.display; string wpspin = wpsmanager.pin; log.i(tag,"pin on device is:"+wpspin); system.out.println("pin on device is:"+wpspin); int wpsstatus = wpsmanager.describecontents(); log.i(tag,"status of device is:"+wpsstatus); system.out.println("status of device is:\"+wpsstatus"); return cmdexecstatus.success; }
try this:
wpsinfo getwpsconfig(){ wpsinfo config=new wpsinfo(); if(cmdparams[0].equalsignorecase("pbc")){ config.setup=wpsinfo.pbc; } else if(cmdparams[0].equalsignorecase("pin")){ config.setup=wpsinfo.display; } else { config.setup=wpsinfo.invalid; } return config; }
and
wifimanager mwifimanager = (wifimanager)getsystemservice(context.wifi_service); mwifimanager.startwps(getwpsconfig(), new wifimanager.wpscallback() { @override public void onstarted(string pin) { log.d("wps", "onstarted " + pin); } @override public void onsucceeded() { log.d("wps", "onsucceeded"); } @override public void onfailed(int reason) { log.d("wps", "onfailed"); } });
also don't forget add permissions in manifest file.
Comments
Post a Comment