Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access WiFi status? #46

Open
AnnkatrinJung opened this issue May 24, 2017 · 1 comment
Open

How to access WiFi status? #46

AnnkatrinJung opened this issue May 24, 2017 · 1 comment

Comments

@AnnkatrinJung
Copy link

Hello,

I tried using the WiFiVelocity framework to get information about nearby WiFi networks. I managed to get an instance of the W5Status class through a handler class, but all of its properties (W5WiFiStatus, W5BluetoothStatus etc.) are nil. I can't find any methods in the headers to start a scan or something like that.
Does anyone know how I can access the WiFi status? I'd appreciate the help :)

Here's my code:

WiFiManagerHandler header:

@interface WifiManagerHandler : NSObject

+ (WifiManagerHandler*) sharedInstance;

- (id) wifiStatus;

- (NSString*) bss;

- (id) desc;

@end

.m file:

#import "W5WiFiStatus.h"
#import "W5Status.h"
#import "WifiManagerHandler.h"

static W5Status *_status = nil;
static WifiManagerHandler *_handler = nil;

@implementation WifiManagerHandler

+ (WifiManagerHandler*) sharedInstance {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        
       NSBundle *b = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/WiFiVelocity.framework"];
        if (![b load]) {
            NSLog(@"Error: Framework not found"); 
        } else {
            Class stat = NSClassFromString(@"W5Status");
            _status = [[stat alloc] init];
            _handler = [[WifiManagerHandler alloc] init];
        }
    });
    return _handler;
}

- (id) wifiStatus {
    return [_status wifi];
}

- (NSString*) bss {
    return [[_status wifi] bssid];
}

- (id) desc {
    return [_status description];
}

@end
@kdongare
Copy link

Any idea how do we implement this in xamarin.forms?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants