使用 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 的相关文章

  • 以编程方式将 MenuItem 添加到菜单的特定位置或组

    我有一个
  • 如何在 Android 中的 onCreate() 内部创建方法

    如何在里面创建一个方法onCreate 方法 当我创建它的显示错误时 令牌 void 预期存在语法错误 并且如果无法在内部创建方法onCreate 方法比请告诉我如何在外部创建方法onCreate 并通过mContext and mActi
  • 视图绑定对应用程序大小的影响有多大?

    View Binding 按照文档的规定 为每个XML元素生成一个Binding类 以方便访问和检查 并减轻如下的时间负担 findViewById 虽然findViewById通过更昂贵的关联搜索进行操作 由于映射 绑定应该 直接 访问
  • 如何从 Cursor 获取行 ID

    如何从游标获取行 ID 我不认为 Cursor 直接暴露了这一点 SQLiteDatabase insert 返回新插入行的行 ID 或者在 Android 中 惯例是有一个名为 id 包含表的主自动增量键 所以cursor getLong
  • 无法实例化接收器 com.parse.GcmBroadcastReceiver

    我正在编写一个使用 GCM 通知和解析推送的离子应用程序 这个应用程序正在使用这些插件 com ionic keyboard 1 0 3 Keyboard com phonegap plugins PushPlugin 2 4 0 Push
  • 自定义视图的Ondraw无限循环android

    我的自定义视图的 OnDraw 函数被无限调用并且正在循环 可能的原因是什么 这是我的自定义视图 public class Balls extends View private static final String TAG BallsVi
  • 命名管道性能问题

    我使用命名管道进行 C 和 Delphi 之间的过程间通信 C 使用System IO Pipes包 而 Delphi 使用Libby s pipes pas 不幸的是 通信几乎是高性能的 分析显示通信占用了整个运行时间的 72 其余的用于
  • Kotlin - 即使有 init() 函数,属性也必须初始化或者是抽象的

    我已使用 Android Studio 3 0 将此代码从 Java 转换为 Kotlin internal var background Drawable internal var xMark Drawable private fun i
  • 使用 Gradle 进行 Travis-CI Android 测试总是超时

    我正在尝试在 Travis CI 上构建和测试我的项目 它每次都会在我的所有存储库上向我显示相同的重复输出 这是我的 travis ymlhttps github com carts uiet cartsbusboarding blob m
  • 检查应用程序是否首次运行[重复]

    这个问题在这里已经有答案了 我是 Android 开发新手 我想根据应用程序安装后首次运行来设置一些应用程序的属性 有什么方法可以发现应用程序是第一次运行 然后设置其首次运行属性吗 下面是一个使用的例子SharedPreferences实现
  • Facebook Android 意图

    我对这个意图有疑问 这个意图是发送文本类型的消息 一切正常 电子邮件 短信 推特以及手机上的任何内容 但唯一有问题的是facebook 它会尝试以链接而不是文本的形式发布 Intent s new Intent android conten
  • 在哪里可以获得用于导入 libcore.io 的 JAR?

    我想处理一个GaiException在我的应用程序中 调试器告诉我 它位于 libcore io 包中 但导入它会产生错误 我想我需要向我的项目添加一个额外的 JAR 才能正确解析此类型 我在我的 android sdk 文件夹中进行了一些
  • 点击当前选项卡刷新页面时的 Xamarin.Forms TabbedPage 事件

    我正在使用 Xamarin Forms 构建 iOS Android 应用程序 并有一个 TabbedPage 如果用户已经在选项卡 2 上 并且单击了选项卡 2 并且我希望刷新选项卡 2 或者运行我自己的函数 以便我可以自己刷新它 有没有
  • 如何使用云打印打印Android活动显示

    我正在尝试将 Google 云打印实现到应用程序中 遵循集成指南 https developers google com cloud print docs android 我试图通过打印 google com 来保持基本 单击我创建的打印按
  • 如何在kotlin中使用Coroutine每秒调用一个函数

    我刚刚创建了一个应用程序 其中我的函数 getdata 每秒调用一次以从服务器获取新数据 而 updateui 函数将更新 UI 中的视图 我在我的应用程序中不使用任何异步任务或协程 我想这样做 请告诉我我怎样才能做到这一点 这是我的代码
  • Phonegap facebook 插件:android 的各种问题

    我正在尝试将 Phonegap 3 1 与 Phonegap facebook plugin 集成 以使我的应用程序能够使用 facebook 登录 https github com phonegap phonegap facebook p
  • QML MouseArea 将事件传播到按钮

    我正在开发一个应用程序 其菜单类似于 Android 版 Gmail 收件箱应用程序菜单 基本上 当您按下按钮打开菜单时 它就会滑入视图 用户可以将其滑开或按菜单上的按钮 对于滑动我使用了代码SwipeArea from kovrov ht
  • 查找配对的 Android 蓝牙设备是否在范围内的正确方法?

    我想编写一个充当蓝牙客户端的应用程序 我想做的是找出最好的方法来确定我支持的特定设备是否在范围内 而不是一直尝试在其上执行 BluetoothDevice connect 并失败如果不在范围内 这里我们假设设备已经配对 恐怕在特定设备处于范
  • Android - 保留或删除应用程序卸载时创建的文件

    我创建了一个应用程序 用于创建文件并将其存储到 SD 卡 有没有办法将文件夹与应用程序绑定 以便当用户在 Android 设备上运行卸载时删除所有文件 自 2009 年以来似乎有了一些进展 来自文档 http developer andro
  • 如何检测用户是否禁用 GPS(Android - Play 服务)

    我使用 gms location LocationListener Google Play 服务 来获取用户的位置 它工作正常 但我想检测用户何时禁用或启用他 她的 GPS 就像这张照片一样 当我打开 关闭位置时 不会调用任何方法 当我切换

随机推荐

  • 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