- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi andorid应用程序检查Wifi有效还是无效
type
TForm1 = class(TForm)
function IsWifiEnabled: Boolean;
end;
uses
Androidapi.Helpers,
Androidapi.JNI.JavaTypes,
Androidapi.JNI.GraphicsContentViewText,
Androidapi.JNIBridge,
Androidapi.JNI.WifiManager;
function TForm1.IsWifiEnabled: Boolean;
var
Obj: JObject;
WifiManager: JWifiManager;
begin
Obj := SharedActivityContext.getSystemService
(TJContext.JavaClass.WIFI_SERVICE);
if Obj = nil then
Exit(False);
WifiManager := TJWiFiManager.Wrap((Obj as ILocalObject).GetObjectID);
Result := WifiManager.isWifiEnabled;
end;