本文整理自网络,侵删。
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;
相关阅读 >>
Delphi try abort、exit except 、finally end 执行情况
更多相关阅读请进入《Delphi》频道 >>