开发者

BSSID of Nearby Networks w/ Titanium

How can I retrieve the BSSID / mac address and strength of nearby WiFi networks (not the local device) from an Android / iOS application? This application has been built using Titanium. Titanium.Platform provides 开发者_运维问答the macaddress for the device, not the outside networks.

If this is not possible using the current API, does anyone know of / have a module that can solve this problem?


You cannot get the BSSID with the TI platform. You can write a module that can read it. It will be something like:

NSArray *ifs = (id)CNCopySupportedInterfaces();
NSLog(@"%s: Supported interfaces: %@", __func__, ifs);
id info = nil;
for (NSString *ifnam in ifs) {
    info = (id)CNCopyCurrentNetworkInfo((CFStringRef)ifnam);
    NSLog(@"%s: %@ => %@", __func__, ifnam, info);
    BSSID=[info valueForKey:@"BSSID"];
    if (info && [info count]) {
        break;
    }
    [info release];
}
[ifs release];
return BSSID;

However, do note that there is a bug as of IOS 5 that prevents you from reading the BSSID if the SSID is the same on all your APs. It won't refresh the BSSID properly. I'm still waiting on a fix or alternate solution so if anyone has something I would appreciate it!


You can get the mac address information using Titanium.Platform.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜