有什么办法可以获得特定wifi路由器的任何唯一标识符吗?
我正在尝试编写一个Android应用程序,需要知道它连接到哪个路由器.我知道android提供了获取当前连接网络的BSSID的方法,但令我惊讶的是,这并不是唯一的.
我发现在双频路由器上,两个不同的设备可能会获得两个不同的BSSID,即使它们位于相同的SSID上.
我可以获取任何其他参数,可以唯一标识我连接的wifi吗?我想尝试一些第三方库,如果这样可以允许我,因为我很确定Android没有包装更好的方法而不是给我BSSID.
编辑:我试图找出谁将他们的家庭wifi(通过应用程序)设置为与我相同的Wi-Fi.每个用户设置他们的"家庭Wi-Fi",它被保存在服务器上(mac地址是我正在保存的).然后,每个用户都可以查询所有人都在他们的Wi-Fi上,以及他们当前是否在该Wi-Fi上连接."谁在我的wifi上"的查询是通过搜索与我连接的MAC地址相同的MAC地址来完成的.如果我的家有双频段,则会失败,因为它们可能连接到第二频率(因此第二个MAC).
有很多方法可以为ListViews设置样式以使它们看起来优雅,但所有这些方法都涉及修改适配器或编写其他代码.
随着Android 4.0的发布,不幸的事情必须改变.谷歌打磨了他们的Holo主题并赋予它新的外观.现在鼓励所有开发人员使用它,以使所有应用程序看起来都一样.
这就是问题所在.谷歌推出4.0,但仍有人使用较旧的Android版本.我们不能只保留以前的自定义应用程序主题并使用Holo,因为它会破坏使用旧设备的用户的视觉体验.我们不能强迫4.0用户只使用Holo,因为我们说实话 - 它仍然不完美.
目标是使用内置主题系统并为Holo准备一些替代品,这在所有设备上看起来都很棒.然后我们可以只使用setTheme()在Holo和我们的主题之间切换,而不会出现其他问题.不幸的是,事情并非那么简单.我们仅限于现有主题系统的功能,有些事情很难做到.这是我的问题.
考虑到我提到的一切,我们如何控制ListView外观?我无法弄明白,如何:

该解决方案应该影响PreferenceActivity创建的ListView,而无需任何额外的代码行.一切都应该包含在主题中:
<theme name="SampleTheme" parent="android:Theme">
...
</theme>
Run Code Online (Sandbox Code Playgroud)
我恳请不要发布不使用样式和主题的解决方案.它们可以在另一个问题中轻松找到,这里是Stack Overflow.
提前致谢.
我试图让地图只填写屏幕的上半部分和下半部分的其他布局.现在我知道这应该可以使用权重与tablelayout结合使用.但是同一段XML代码与say按钮完美配合,但与map无关.
屏幕截图在这里.
XML代码:
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
>
<com.google.android.maps.MapView
android:id="@+id/map2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="0_z4IHjB6EnXohnoyoudontgoVmhg"
android:clickable="true" >
</com.google.android.maps.MapView>
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
<Button android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="SECOND"></Button>
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
<Button android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="SECOND"></Button>
</TableRow>
</TableLayout>
Run Code Online (Sandbox Code Playgroud)
如果你用一个按钮替换Mapview块,它将看起来像截图中的第一个图像,而现在它看起来像第二个.
在这两种情况下,我都没有改变任何重量参数或layout_width或height,但它以某种方式改变了大小.任何想法我怎么能让MapView只覆盖一半的屏幕?
我按照phonegap-nfc项目页面上的说明为我的phonegap项目安装了nfc插件.
在启动应用程序时,我确实看到了Waiting for NDEF tag警报.但是,在将NFC卡轻触手机时,我只能听到失败的NFC声音(您可以在此视频中听到声音).我不确定这里有什么不对.
代码与上面第一个链接的指示完全相同.为简洁起见,我也会在这里复制代码:
我的index.js有 -
onDeviceReady: function() {
app.receivedEvent('deviceready');
// Read NDEF formatted NFC Tags
nfc.addNdefListener (
function (nfcEvent) {
var tag = nfcEvent.tag,
ndefMessage = tag.ndefMessage;
// dump the raw json of the message
// note: real code will need to decode
// the payload from each record
alert(JSON.stringify(ndefMessage));
// assuming the first record in the message has
// a payload that can be converted to a string.
alert(nfc.bytesToString(ndefMessage[0].payload).substring(3));
}, …Run Code Online (Sandbox Code Playgroud) 极端的noob在这里,我试图在if else语句中导出语句而不是字符串.一些如何不工作,请帮助.
if(number==0) { canvas.drawColor(Color.rgb(123, 214, 217)); }
elseif(number==1) { canvas.drawColor(Color.rgb(121, 214, 217)); }
else { canvas.drawColor(Color.rgb(54, 214, 217)); }
Run Code Online (Sandbox Code Playgroud)