- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
通过 Wi-Fi Direct 创建组时,我知道我可以创建一个持久组。
我的问题是:我可以创建一个永久组,但每次都更改组所有者(即,每轮组所有者将成为组中的设备之一)。
另外,创建持久化组时,只要求第一次接受连接,对吧?
最佳答案
您现在可以通过 WifiP2pManager.createGroup(..)
创建一个新的永久组。它将创建一个新组并使调用设备 (A) 成为组所有者,并且可以执行您描述的操作。唯一的问题是一旦您创建了一个组并连接到另一台设备,另一台设备 (B) 就会记住该特定组。如果您尝试在 A 中创建一个新群组(例如,再次打开应用程序)并尝试从 B 连接,它会自动加入旧群组,而不是像在 A 的新群组中连接一样。
编辑:有一种方法可以清除所有持久性组。这是一个名为 deletePersistentGroups
的隐藏函数。虽然这会消灭每一个,但这似乎是解决问题的唯一可靠方法。在你调用 WifiP2pManager.initialize(..)
之后调用它,这样你就可以使用 channel 了。
private void deletePersistentGroups(){
try {
Method[] methods = WifiP2pManager.class.getMethods();
for (int i = 0; i < methods.length; i++) {
if (methods[i].getName().equals("deletePersistentGroup")) {
// Delete any persistent group
for (int netid = 0; netid < 32; netid++) {
methods[i].invoke(wifiP2pManager, mChannel, netid, null);
}
}
}
} catch(Exception e) {
e.printStackTrace();
}
}
我不太确定为什么 netid
会上升到 31,我会假设这是允许的最大连接数。代码取自 here .
关于android - 我可以在 Wi-Fi Direct 中更改永久组中的组所有者吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15152817/
在JSON输出中,“步骤”中有一个字段“maneuver”。在此“向左转”,“向右转”,“向左转轻微”等。示例为here 在哪里可以找到“操纵”字段的定义以及可能的值列表?没有相关描述here 提前致
默认情况下,我们如何从Google Direction API建议的替代 route 获得从A点到B点的最短距离路线?默认情况下,它会根据当前交通状况为我们提供最短持续时间的路线。我已经注意到,如果您
我想知道“precompile(r) directive”和“preprocessor directive”是一回事吗?我对前者不熟悉,但只是听说过,并通过这个Google在互联网上找到了一些关于它的
对于我的项目,我目前正在开发自定义表单/输入指令。 例如,我有以下指令: angular.module('myApp').directive("textField", function() {
我用谷歌搜索了一下,但找不到任何详细说明如何制作动态包装内容的 Angular 指令的内容(例如 http://demos.telerik.com/kendo-ui/panelbar/angular
我正在尝试在另一个指令中使用一个指令。具体来说,我有一个模态指令,我想传递一个表单指令,并将充当模态的主体。 我的模态指令: angular.module('Storyboard').dir
我构建了一个模块化形式的小型演示,其中包含单独的输入指令。它还可以预览绑定(bind)到相同 Controller 和范围的表单值。 导致问题的输入指令是嵌入到表单内的输入:
HTML 指令 .directive('authorname', function() { return { restrict: 'E', scope: {
我有可以编译的 Angular 指令 至和 至Hello World! 我怎样才能把greeting在我的 HTML 中标记并将其编译为 print-greeting然后最后显示Hello World
标题中引用的脚注是什么意思?这是 6.10.3p11 的脚注 If there are sequences of preprocessing tokens within the list of arg
因此,电话号码始终是 ltr(从左到右)。 在多语言网站上工作,我需要在方向为 rtl 的文本段落中插入一个电话号码(带有“+”前缀和由“-”分隔的数字)(当然是针对相关语言) 所以我有这样的东西:
我有一个标题元素,我想显示 flex 列,这样我就可以将 .container div 垂直居中。这工作正常。然后我需要 .container 中的元素在 1200px 之间以均匀的间距连续 flex
如何将整个ng-repeat对象传递给指令(或如何将指令的作用域设置为ng-repeat项)? 我是新来的有角度的人,很难解决这个问题。 我有一个 Controller ,可以很好地呈现以下内容:
我需要将“...”放在文本前面,并在填充 div 时仅显示文本的最后一部分。 正常时不执行任何操作 C:\fakepath\996571_1398802860346752_209456547
我需要将“...”放在文本的前面,并且只显示它的最后一部分,当它填充 div 时。 正常的时候什么也不做 C:\fakepath\996571_1398802860346752_209456
我需要一个“粘性”指令,当它位于页面顶部时向元素添加一个 css 类,并且还指示其状态的变化。出于这个原因,我定义了一个范围,如 { onStickyChange: '&' }。现在我想在 angul
我对 ngSwitch 指令有点困惑——它是“属性指令”还是“结构指令”。 属性指令用“方括号”编写,如 [ngStyle]、[ngClass] 等(我们将其写为 [ngSwitch],将其称为“属性
Wi-Fi direct 的 Wiki 规范声称“只有一个 Wi-Fi 设备需要兼容 Wi-Fi Direct 才能建立点对点连接,在彼此之间直接传输数据,大大减少了设置”。但是从 android A
我有一个响应式模板,我正尝试将其与我的 Angularjs 应用程序一起使用。这也是我的第一个 Angular 应用程序,所以我知道我在未来有很多错误和重构。 我已经阅读了足够多的关于 Angular
首先,我这样做的方式可能不正确。但我会解释这个问题: 1) 我正在创建名为 的指令 2) 当点击第一个指令中的按钮时,我试图在运行时动态插入第二个指令 如下: var app = angu
我是一名优秀的程序员,十分优秀!