[note] Sign-in app, Android client, server use Bmob service, use Office WiFi MAC address sign in, JKXQJ
1, the reason to do this app: the Friday company Administration told me that I did not sign in July, so decided to take the weekend to do a router based on the MAC address of the check-in app.
2, the afternoon I was in the company to draw a sketch, prepare for the weekend to do it.
3, in fact, this app is very simple, backstage with the Bmob service, development efficiency doubled, half a day to make.
As follows:
4, the core code is as follows:
//Check what network is connected PublicIntegerCheckwifi(Context context) {Connectivitymanager Connectivitymanager = (connectivitymanager) context.getsystemservice (Context.CONNECTIVITY_ SERVICE); Networkinfo mnetworkinfo = Connectivitymanager.getactivenetworkinfo ();if(mnetworkinfo.getstate () = = NetworkInfo.State.CONNECTED) {if(Mnetworkinfo.gettype () = = Connectivitymanager.type_mobile) {return 1;//return 1, connected to a mobile network}Else if(Mnetworkinfo.gettype () = = Connectivitymanager.type_wifi) {return 2;//Return 2, connected to WiFi} }Else{return 3;//Return 3, no connection. }return 3; }//Get IP PublicStringgetlocalipaddress() {Try{ for(Enumeration<networkinterface> en = networkinterface.getnetworkinterfaces (); en.hasmoreelements ();) {NetworkInterface intf = en.nextelement (); for(Enumeration<inetaddress> enumipaddr = intf.getinetaddresses (); enumipaddr.hasmoreelements ();) {InetAddress inetaddress = enumipaddr.nextelement ();if(!inetaddress.isloopbackaddress ()) {returnInetaddress.gethostaddress (). toString (); } } } }Catch(SocketException ex) {LOG.E ("IP address is:", ex.tostring ()); }return NULL; }//Get Mac PublicStringgetlocalmacaddress() {Wifimanager WiFi = (wifimanager) getsystemservice (Context.wifi_service); Wifiinfo info = Wifi.getconnectioninfo ();returnInfo.getmacaddress (); }
5, the project has uploaded GitHub, welcome watch/fork/star/download.
Https://github.com/jkxqj/BianQian
CSDN Code Address:
Https://code.csdn.net/acmjk/bianqian
Copyright NOTICE: This article for Bo Master original article, reproduced please indicate this blog address! Look to the Master,follow the Master,walk with the Master,see through the master, become the master.
"Sticky Notes" sign in App Android client (open source)