Results:
1. You must open access Wi-Fi state permission, do not open permissions will appear in Figure two error.
Related information:
http://blog.csdn.net/lyf_lyf/article/category/173576
Instance code:
1 UnitUnit1;2 3 Interface4 5 uses6 system.sysutils, System.types, System.uitypes, system.classes, System.variants,7 FMX. Types, FMX. Controls, FMX. Forms, FMX. Graphics, FMX. Dialogs, FMX. Scrollbox,8 FMX. Memo, Fmx.stdctrls, FMX. Controls.presentation,9Androidapi.JNI.GraphicsContentViewText,//need to introduceTenAndroidapi.jnibridge,//need to introduce OneAndroidapi.JNI.Telephony,//need to introduce AAndroidapi.JNI.JavaTypes,//need to introduce -FMX. Helpers.android,//need to introduce -Androidapi.JNI.Net,//need to introduce theAndroidapi.helpers;//need to introduce - - type -TForm1 =class(Tform) + Label1:tlabel; - Button1:tbutton; + Memo1:tmemo; A procedureButton1Click (sender:tobject); at Private - {Private Declarations} - Public - {Public Declarations} - End; - in var - Form1:tform1; to + Implementation - the {$R *.FMX} * {$R *. NMXHDPIPH.FMX ANDROID} $ Panax Notoginseng //IP Address integer to string - functionInt2ip (Intip:int64):string; the var + N:int64; AIP4, IP3, IP2, ip1:string; the begin +Result: ="'; -N: = IntipSHR -; $Intip: = IntipXOR(nSHL -); $IP4: =inttostr (n); - -N: = IntipSHR -; theIntip: = IntipXOR(nSHL -); -IP3: =inttostr (n);Wuyi theN: = IntipSHR 8; -Intip: = IntipXOR(nSHL 8); WuIP2: =inttostr (n); - AboutN: =Intip; $IP1: =inttostr (n); - -Result: = ip1 +'.'+ IP2 +'.'+ IP3 +'.'+IP4; - End; A + //IP address string to integer (not measured) the functionIp2int (ConstStrIP:string): Int64; - var $ lst:tstringlist; the I:integer; the begin theResult: =0; theLST: = tstringlist.Create; - Try inLst. Delimiter: ='.'; theLst. Delimitedtext: =StrIP; the forI: =0 toLst. Count-1 Do AboutResult: = result + StrToInt64 (Lst[i])SHL( -I8); the finally the lst. Free; the End; + End; - the procedureTform1.button1click (sender:tobject);Bayi var the Service:jobject; the Wifimanager:jwifimanager; - Connectioninfo:jwifiinfo; - scanresults:jlist; the Scanresult:jscanresult; the I:integer; the Iip:int64; the begin - Memo1.Lines.Clear; theService: =Sharedactivity.getsystemservice (TJContext.JavaClass.WIFI_SERVICE); theWifimanager: = Tjwifimanager.wrap (Service asilocalobject). Getobjectid); the if notWifimanager.iswifienabled Then94MEMO1.LINES.ADD ('WiFi disabled') the Else the begin theConnectionInfo: =Wifimanager.getconnectioninfo;98MEMO1.LINES.ADD ('Connection Information'); AboutMEMO1.LINES.ADD ('SSID:'+jstringtostring (Connectioninfo.getssid)); -MEMO1.LINES.ADD ('BSSID:'+jstringtostring (Connectioninfo.getbssid));101MEMO1.LINES.ADD ('IPV4:'+Int2ip (connectioninfo.getipaddress));102MEMO1.LINES.ADD ('MAC Address:'+jstringtostring (connectioninfo.getmacaddress));103Scanresults: =Wifimanager.getscanresults;104 forI: =0 toScanresults.size-1 Do the begin106MEMO1.LINES.ADD ("');107MEMO1.LINES.ADD ('detected access points'+IntToStr (I));108Scanresult: = Tjscanresult.wrap ((Scanresults.get (I) asilocalobject). Getobjectid);109MEMO1.LINES.ADD ('SSID:'+jstringtostring (Scanresult.ssid)); theMEMO1.LINES.ADD ('BSSID:'+jstringtostring (Scanresult.bssid));111MEMO1.LINES.ADD ('Capabilities:'+jstringtostring (scanresult.capabilities)); theMEMO1.LINES.ADD ('Frequency:'+ INTTOSTR (scanresult.frequency) +'MHz');113MEMO1.LINES.ADD ('Signal Level:'+ INTTOSTR (scanresult.level) +'dBm'); the End the End; the End;117 118 End.
Android Instance-get the Android phone WiFi information (xe8+ Xiaomi 2)