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 - 利用dll编程控制摄像头实现拍照、录制视频

Delphi 最简单的判断数字函数

Delphi enumwindows 获取窗体句柄 进程id 窗体信息

Delphi firedac,ado性能测试

Delphi webbrowser 自动登录

Delphi中关于时间差的实例

Delphi inttohex

Delphi tms web core tedit编辑输入框属性展示

Delphi string转换成tstrings

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



打赏

取消

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

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

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

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

评论

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