- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试为 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;
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;
关于android - 使用 Delphi XE5 for Android 创建 WifiConfiguration,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19890438/
Android 6.0 对 WiFi 行为进行了一些更改,它破坏了我的应用程序行为并且找不到解决方案。 基本上,对于 Android 6.0,您不能修改或删除不是由您的应用创建的 WifiConfig
我正在尝试创建一个 WifiConfiguration,但是,如果我编写以下内容: WifiConfiguration conf = new WifiConfiguration(); conf.SSI
我使用 Wifimanager addNetwork() 添加三个配置,然后我想删除这些。 如何获取我的应用创建的配置。 最佳答案 如果我没看错,您需要从您的应用中删除这些添加的 WiFi。 使用 W
当我想将我的设备连接到现有网络 wifi 时遇到问题。 情况是这样的: 我正在寻找现有的已配置网络,如果没有我正在寻找的网络,我会构建它,然后尝试连接手机。 当使用手机界面手动构建wifi配置时,我可
我在做 Wifi 项目,有一个模块可以让用户以编程方式加入 wifi。 在 kitkat 及以下版本中它运行成功,但在 Lollipop 中它不起作用。 代码如下: WifiManager wifiM
问题: 类型不匹配:无法从元素类型 Object 转换为 WifiConfiguration 第 124 行 问题位置第 124 行:for(WifiConfiguration i : list){
我正在尝试为 Android 创建一个 WifiConfiguration。 可以设置所有其他属性。 但是如果我尝试设置 SSID 或 BSSID,我会遇到段错误 (11),并且应用程序和 Delph
WifiConfiguration conf = new WifiConfiguration(); conf.SSID = "ssid"; conf.preSharedKey = "\"密码\"";
我正在尝试使用我之前在此处看到的代码将我的 Android 设备设置为接入点: WifiManager wifi = (WifiManager) getSystemService(Context.WI
我正在创建范围内的 wifis 列表并将其显示给用户。我希望用户可以选择列表中的每一项并输入密码以连接到所选的 SSID。 我为wifi连接写了这个方法: private WifiConfig
String networkSSID = "networkName"; String networkPassword = "networkPassword"; WifiManager wm = (Wi
我需要将带有代理设置的 WifiConfiguration 添加到 WifiManager。当我不使用 sethttpProxy (我根本不添加代理)时,我可以成功添加配置,但是当我使用方法 wifi
你们这些 Android 高手是否知道任何开源代码来创建 WifiConfiguration来自给定的 ScanResult ?这会很有帮助。事实上,我捕获的(2012 年 4 月中旬)Android
在 Android 1.5 中(也适用于 1.6) 如何通过代码添加接入点? 给定支持 WPA2 的接入点。这是我的代码 fragment 。 WifiManager wifi = (WifiMana
我需要从 WifiConfiguration 条目中获取安全类型。可能吗? String getSecurityType(WifiConfiguration conf) { } 返回值 “NONE”、
我是一名优秀的程序员,十分优秀!