使用 Delphi XE5 for Android 创建 WifiConfiguration

2024-01-08

我正在尝试为 Android 创建 WifiConfiguration。 可以设置所有其他属性。 但如果我尝试设置 SSID 或 BSSID,则会出现分段错误 (11),并且应用程序和 Delphi 会挂起。

var
  WIFIConfig: JWifiConfiguration;
begin
  WIFIConfig :=  TJWifiConfiguration.JavaClass.init; 
  WIFIConfig.hiddenSSID := false;                         -> works
  WIFIConfig.SSID := StringtoJString('"YOUR_WLAN_SSID"'); -> App just hangs
end;

http://developer.android.com/reference/android/net/wifi/WifiConfiguration.html http://developer.android.com/reference/android/net/wifi/WifiConfiguration.html

   JWifiConfigurationClass = interface(JObjectClass)
    ['{F69F53BC-BC63-436A-8DA9-57389B30CAA8}']
    function init: JWifiConfiguration; cdecl; overload;

  end;

  [JavaSignature('android/net/wifi/WifiConfiguration')]
  JWifiConfiguration = interface(JObject)
    ['{382E85F2-6BF8-4255-BA3C-03C696BC6451}']
    function _GetSSID: JString;
    procedure _SetSSID(Value: JString);
    function _GetBSSID: JString;
    procedure _SetBSSID(Value: JString);
    function _GethiddenSSID: boolean;
    procedure _SethiddenSSID(Value: boolean);
    function _GetallowedAuthAlgorithms: JBitSet;
    procedure _SetallowedAuthAlgorithms(Value: JBitSet);
    function _GetallowedGroupCiphers: JBitSet;
    procedure _SetallowedGroupCiphers(Value: JBitSet);
    function _GetallowedKeyManagement: JBitSet;
    procedure _SetallowedKeyManagement(Value: JBitSet);
    function _GetallowedPairwiseCiphers: JBitSet;
    procedure _SetallowedPairwiseCiphers(Value: JBitSet);
    function _GetallowedProtocols: JBitSet;
    procedure _SetallowedProtocols(Value: JBitSet);
    function _GetnetworkId: integer;
    procedure _SetnetworkId(Value: integer);
    function _GetpreSharedKey: JString;
    procedure _SetpreSharedKey(Value: JString);
    function _Getstatus: integer;
    procedure _Setstatus(Value: integer);
    function _GetwepTxKeyIndex: integer;
    procedure _SetwepTxKeyIndex(Value: integer);
    function _GetwepKeys: TJavaObjectArray<JString>;
    procedure _SetwepKeys(Value: TJavaObjectArray<JString>);

    property SSID: JString read _GetSSID write _SetSSID;
    property BSSID: JString read _GetBSSID write _SetBSSID;
    property allowedAuthAlgorithms: JBitSet read _GetallowedAuthAlgorithms write _SetallowedAuthAlgorithms;
    property allowedGroupCiphers: JBitSet read _GetallowedGroupCiphers write _SetallowedGroupCiphers;
    property allowedKeyManagement: JBitSet read _GetallowedKeyManagement write _SetallowedKeyManagement;
    property allowedPairwiseCiphers: JBitSet read _GetallowedPairwiseCiphers write _SetallowedPairwiseCiphers;
    property allowedProtocols: JBitSet read _GetallowedProtocols write _SetallowedProtocols;
    property hiddenSSID: boolean read _GethiddenSSID write _SethiddenSSID;
    property networkId: integer read _GetnetworkId write _SetnetworkId;
    property preSharedKey: JString read _GetpreSharedKey write _SetpreSharedKey;
    property priority: integer read _GetnetworkId write _SetnetworkId;
    property status: integer read _Getstatus write _Setstatus;
    property wepKeys: TJavaObjectArray<JString> read _GetwepKeys write _SetwepKeys;
    property wepTxKeyIndex: integer read _GetwepTxKeyIndex write _SetwepTxKeyIndex;

  end;

  TJWifiConfiguration = class(TJavaGenericImport<JWifiConfigurationClass,
    JWifiConfiguration>)
  end;

你错过了cdecl调用您所有的约定JWifiConfiguration方法。

[JavaSignature('android/net/wifi/WifiConfiguration')]
JWifiConfiguration = interface(JObject)
  ['{382E85F2-6BF8-4255-BA3C-03C696BC6451}']
  function _GetSSID: JString; cdecl;
  procedure _SetSSID(Value: JString); cdecl;
  function _GetBSSID: JString; cdecl;
  procedure _SetBSSID(Value: JString); cdecl;
  function _GethiddenSSID: boolean; cdecl;
  procedure _SethiddenSSID(Value: boolean); cdecl;
  function _GetallowedAuthAlgorithms: JBitSet; cdecl;
  procedure _SetallowedAuthAlgorithms(Value: JBitSet); cdecl;
  function _GetallowedGroupCiphers: JBitSet; cdecl;
  procedure _SetallowedGroupCiphers(Value: JBitSet); cdecl;
  function _GetallowedKeyManagement: JBitSet; cdecl;
  procedure _SetallowedKeyManagement(Value: JBitSet); cdecl;
  function _GetallowedPairwiseCiphers: JBitSet; cdecl;
  procedure _SetallowedPairwiseCiphers(Value: JBitSet); cdecl;
  function _GetallowedProtocols: JBitSet; cdecl;
  procedure _SetallowedProtocols(Value: JBitSet); cdecl;
  function _GetnetworkId: integer; cdecl;
  procedure _SetnetworkId(Value: integer); cdecl;
  function _GetpreSharedKey: JString; cdecl;
  procedure _SetpreSharedKey(Value: JString); cdecl;
  function _Getstatus: integer; cdecl;
  procedure _Setstatus(Value: integer); cdecl;
  function _GetwepTxKeyIndex: integer; cdecl;
  procedure _SetwepTxKeyIndex(Value: integer); cdecl;
  function _GetwepKeys: TJavaObjectArray<JString>; cdecl;
  procedure _SetwepKeys(Value: TJavaObjectArray<JString>); cdecl;

  property SSID: JString read _GetSSID write _SetSSID;
  property BSSID: JString read _GetBSSID write _SetBSSID;
  property allowedAuthAlgorithms: JBitSet read _GetallowedAuthAlgorithms write _SetallowedAuthAlgorithms;
  property allowedGroupCiphers: JBitSet read _GetallowedGroupCiphers write _SetallowedGroupCiphers;
  property allowedKeyManagement: JBitSet read _GetallowedKeyManagement write _SetallowedKeyManagement;
  property allowedPairwiseCiphers: JBitSet read _GetallowedPairwiseCiphers write _SetallowedPairwiseCiphers;
  property allowedProtocols: JBitSet read _GetallowedProtocols write _SetallowedProtocols;
  property hiddenSSID: boolean read _GethiddenSSID write _SethiddenSSID;
  property networkId: integer read _GetnetworkId write _SetnetworkId;
  property preSharedKey: JString read _GetpreSharedKey write _SetpreSharedKey;
  property priority: integer read _GetnetworkId write _SetnetworkId;
  property status: integer read _Getstatus write _Setstatus;
  property wepKeys: TJavaObjectArray<JString> read _GetwepKeys write _SetwepKeys;
  property wepTxKeyIndex: integer read _GetwepTxKeyIndex write _SetwepTxKeyIndex;
end;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 Delphi XE5 for Android 创建 WifiConfiguration 的相关文章

  • 定期运行任务(每天一次/每周一次)

    我想定期 每周 每天一次 运行一些任务 即获取我的网站新闻页面 即使我的应用程序已关闭 是否可以 是的 您需要查看报警管理器 http developer android com reference android app AlarmMan
  • 如何检测和管理来电(Android)?

    我想创建一个应用程序 可以检测来电并在一定数量的蜂鸣声 响铃 后启动我的自定义活动 我的意思是在 2 或 3 或 5 声蜂鸣声 响铃 后我的activity被触发 我该怎么做 Thanks 我认为您无法计算自来电开始以来电话响了多少次 无法
  • Android中如何使用洪水填充算法?

    我是Android编程新手 最近尝试编写一个简单的应用程序 仅供练习 在这个中 我想在用户点击时为图像着色 但我不知道如何开始 我读过不同的主题 其中提到使用 洪水填充 算法 我在网上找到了它 但我不知道如何将它放入我的简单应用程序中 我找
  • 使用 APDU 命令的有效 NFC 读取比特率是多少?

    我目前正在使用 Android IsoDep trancieve 函数发送和接收累计 1628 字节的数据 该函数分布在 35 个 APDU 命令 选择应用程序 身份验证 读取 中 字节计数包括返回的 MAC 校验和以及由 transcie
  • 如何将 EditText 传递给另一个活动?

    Intent intent new Intent this Name class intent putExtra key et getText toString startActivity intent Intent intent getI
  • SQLite (Android):使用 ORDER BY 更新查询

    Android SQLite 我想要在 myTable 中的其他行之间插入行在android中使用SQLite 为此 我尝试增加从第 3 行开始的所有行的 id 这样 我就可以在位置 3 处插入新行 myTable 的主键是列 id 表中没
  • 如何使用闹钟音量和 setAudioAttributes 来播放铃声?

    所以我正在尝试了解音频属性 这是我到目前为止所拥有的 alarm getSound will return a proper URI to pick a ringtone Ringtone tone RingtoneManager getR
  • 访问角落里的存储

    我能找到的与文件存储有关的最接近文档的是这个帖子 http nookdeveloper zendesk com entries 20257971 updated what are the size constraints on my app
  • Android - 当不在栏顶部时推送通知空白

    我在使用 Android 推送通知时遇到一个小问题 如果有 3 个通知 并且只有其中一个显示标题和消息 位于酒吧顶部的那个 如果有人知道可能是什么问题 请告诉我 请参阅此链接上的图像 这就是我接收通知的方式http postimg org
  • 如何在 Firebase 远程配置中从 JSON 获取值

    我是 Android 应用开发和 Firebase 的新手 我想知道如何获取存储在 Firebase 远程配置中的 JSONArray 文件中的值 String 和 Int 我使用 Firebase Remote Config 的最终目标是
  • SQLite支持android的数据类型有哪些

    谁能告诉我 SQLITE 中支持 ANDROID 的数据类型列表 我想确认 TIME 和 DATE 数据类型 这里有一个list http www sqlite org datatype3 htmlSQLite 的数据类型 支持时间和日期间
  • 如何在 iOS 应用程序中通过其他应用程序共享内容/数据,就像我们在 Android 应用程序中使用 Intent.ACTION_SEND 所做的那样?

    在Android中 我们可以通过Intent ACTION SEND startactivity api轻松共享内容 文本 图像 视频等 我已经有一个应用程序可以完美地做到这一点 并且有一个并行的 iOS 应用程序 我希望它能够实现相同的功
  • Android ListView setSelection() 似乎不起作用

    我有一个ListActivity实现onListItemClick 并调用doSomething 类的功能 后者包含l setSelection position where l is the ListView object 现在有一个on
  • 如何从android获取应用程序安装时间

    我尝试了一些方法 但没有成功 请帮助我 PackageManager pm context getPackageManager ApplicationInfo appInfo pm getApplicationInfo app packag
  • 如何在Android Compose中使用otf类型字体文件?

    我正在学习使用 Android Jetpack Compose 现在我有一个正则 otf字体文件在资产 字体 我想在文本中使用它 java lang RuntimeException Font asset not found commonu
  • android 中camera.setParameters 失败

    我已将相机功能包含在我的应用程序中 我还在市场上推出了该应用程序 我从一位用户那里收到一条错误消息 称他在打开相机时遇到错误 我已经在 2 1 的设备上测试了该应用程序 我从用户那里得到的错误是使用 Nexus One 它主要运行 2 2
  • Android:确定 2.2 及更高版本上的摄像头数量

    我的应用程序需要在 Android 2 2 及更高版本上运行 我需要一种方法来确定可用摄像机的数量 有很多帖子解决了这个问题 但我找不到一个有效的 一种解决方案是简单地检测操作系统版本 任何 2 2 版本的设备都仅限于 1 个摄像头 即使该
  • Android - iphone 风格 tabhost [关闭]

    就目前情况而言 这个问题不太适合我们的问答形式 我们希望答案得到事实 参考资料或专业知识的支持 但这个问题可能会引发辩论 争论 民意调查或扩展讨论 如果您觉得这个问题可以改进并可能重新开放 访问帮助中心 help reopen questi
  • Android ADT Eclipse 插件,parseSDKContent 失败

    我刚刚设置了我的第一个 Android 开发环境 其中包括 日食3 5 Mac OS X 10 5 适用于 x86 mac 的 Android SDK ADT Eclipse 插件 0 9 6 我已将 set PATH 设置为我的 SDK
  • 异步更新后更新Android Listview

    我正在将 HTTP 调用从同步调用转换为异步调用 由于连接在后台运行 因此当我最初设置列表适配器时 数据不存在 如何在 HTTP 调用后更新列表适配器 我尝试了一些方法 例如在数据发送回之前不设置适配器并再次设置适配器 但没有任何效果 这是

随机推荐

  • ForkJoinPool#awaitQuithesis 实际上是如何工作的?

    我有下一个实施RecursiveAction 此类的唯一目的 是从 0 到 9 打印 但如果可能的话 从不同的线程打印 public class MyRecursiveAction extends RecursiveAction priva
  • 有没有办法使用 facebook graphQL 接收扁平化数据?

    我刚刚发现 还有像 GraphQL 这样神奇的东西 我很好奇使用这个时是否有任何方法 fields id name description place name location city cover source 得到这个 id 1001
  • 保护 Firestore 中的特定文档字段

    我正在尝试创建一个简单的系统 允许用户使用他们提供的信息创建帐户 现在 我将所有数据存储在一个集合中users其中有一些代表用户的文档 我想保留用户的一些敏感数据 例如电子邮件地址和电话号码 在 Firebase 数据库中 我会创建如下内容
  • 按 Soundex(或类似)“亲密程度”排序

    有什么方法可以让 MySQL 根据结果与搜索词的 听起来 接近程度来对结果进行排序吗 我正在尝试对包含用户输入的城市名称的字段进行排序 存在变体和拼写错误 我想在顶部显示 最接近 的匹配项 我知道 soundex 可能不是最好的算法 但如果
  • 从命令行安装驱动程序 (.inf) 文件

    我正在 Windows 8 1 中工作 我需要安装驱动程序文件 inf文件 从命令行 我需要使用哪个命令 我知道我还有很多其他方法来安装 inf文件 但我必须从命令行安装它 请帮我 提前致谢 Granger 的评论也适用于 Windows
  • Apache Kafka - 主题/分区上的 KafkaStream

    我正在为大容量高速分布式应用程序编写 Kafka Consumer 我只有一个主题 但收到的消息率非常高 拥有多个分区来服务更多消费者将适合此用例 最好的消费方式是拥有多个流读取器 根据文档或可用示例 ConsumerConnector 给
  • 如何为 Android 支持库启用 javadoc?

    当使用 Android 支持库来实现兼容性并尝试查看 javadoc 时 例如 FragmentTransaction 我收到以下错误 因为没有关联的 javadoc 文件 android support v4 app FragmentTr
  • 如何使用 JSTL 对表示 URL 路径的字符串进行编码?

    使用 JSTL 对表示 URL 路径 而不是请求参数 的字符串进行 URL 编码的最佳方法是什么
  • Django 模型、信号和电子邮件发送延迟

    我已经向我的模型添加了一个信号 一旦保存模型 通过models signals post save connect信号和send mail用于发送电子邮件 这个想法仍然会给用户带来延迟 当他们在网站上保存模型时 他们必须等到所有这些电子邮件
  • 如何通过 UiPath 读取 Excel 工作表并将单元格值放入不同的文本字段中?

    如何通过 UiPath 读取 Excel 工作表并将单元格值放入不同的文本字段中 我有一张Excel表格 如下 我已阅读 Excel 内容并稍后迭代内容 我将内容存储在Output Data Table如下 读取范围 输出 数据表 CV数据
  • pyhive、sqlalchemy无法连接到hadoop沙箱

    我已经安装了 pip install thrift pip install PyHive pip install thrift sasl 和 自从pip install sasl我下载失败sasl 0 2 1 cp27 cp27m win
  • abs(unsigned long) 有任何意义吗?

    我遇到过这段代码 我的分析器偶然将其报告为瓶颈 include
  • MVC 3 在哪里加密用户的密码?

    我有自己的密码加密 dll 用于在用户登录时检查用户的密码 这在我的用户实体中引用 现在我已经为用户创建了注册功能 除了密码尚未加密之外 该功能运行良好 我的问题很简单 我应该把新用户密码的加密放在哪里 我不确定 因为我知道用户的密码不应该
  • 我应该在注入的 Angular 服务上使用只读而不是公开它们吗?

    今天我进行了一次讨论 我的一些同事说他们像这样注入 Angular 服务 constructor readonly language I18nService 他们说他们这样做是因为它可以防止我的组件的使用者更改注入的服务 有点像这样 Com
  • Python 类构造函数(静态)

    Python 是否有类构造函数的机制 即每当首次引用类时 而不是创建该对象的实例时 调用的函数 我知道这在其他一些语言中也存在 但我还没有在Python中遇到过 基本上 我想初始化该函数中的一些静态属性 我在下面举了一个我所期望的例子 当然
  • 如何在同一页面上加载多个版本的 jQuery 插件?

    我正在尝试使用最新版本的时间选择器插件 http trentrichardson com examples timepicker 用于 jQuery UI 另一个库已经在早期版本加载了它 1 0 4 但我想使用最新的 1 4 5 版本 在源
  • 使用 Spotify Web API / Playback SDK 检测曲目播放结束

    使用 Spotify Web API 和 Web Playback SDK 有人知道检测曲目播放何时完成 即歌曲结束 的好方法吗 我知道一些名为player state changed在Web Playback SDK中 但是事件中提供的数
  • JavaScript 中二维数组的切片/部分

    我需要用二进制代码获取二维数组的切片 我需要指定我想从哪里开始以及在哪里结束 现在我有这段代码 但我很确定它是错误的 var slice var endx 30 var startx 20 var starty 10 var end 20
  • 如何用Java流畅地构建JSON? [关闭]

    Closed 这个问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 Locked 这个问题及其答案是locked help locked posts因为这个问题是题外话
  • 使用 Delphi XE5 for Android 创建 WifiConfiguration

    我正在尝试为 Android 创建 WifiConfiguration 可以设置所有其他属性 但如果我尝试设置 SSID 或 BSSID 则会出现分段错误 11 并且应用程序和 Delphi 会挂起 var WIFIConfig JWifi