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;

相关阅读 >>

Delphi 屏幕截图完美解决方案

Delphi 从文件中读取图像类型

Delphi 根据窗口类判断程序是否运行

Delphi中转向语句break,continue,exit的作用

Delphi链接自己的主页和邮件

Delphi10.3读取json数组

Delphi 很方便调用的log日志方法

Delphi 纯window系统api实现的ssl客户端

Delphi firedac tfdconnection连接mysql数据库

Delphi应用程序的调试(1-10)

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...