Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get notification of Wifi availability for Wifi enabled device

I have OBD2 device adapter which supports Wifi. Now I want to get notification about Wifi with OBD2 device is available so I can start talking to that device and read data and Wifi with OBD2 device is not available.

When device is connected to OBD2 Port,wifi is broadcasting. I have used sample code of Reachability class. But I can't get proper notification.

I tried with SimplePingHelper code. It works fine with Main thread but it not runs with background thread. SimplePingHelper Source code

SimplePingHelper code actually uses SimplePing sample code from Apple. SimplePing Code By Apple

Can you help me in this code that it works with background thread Or What are other ways I can check to get this notification ?

like image 825
NSS Avatar asked Nov 14 '13 13:11

NSS


People also ask

Is it possible to get notified when someone connects to your Wi-Fi?

Wireless Network Watcher is a free Windows app that tells you whenever new connections are made.


1 Answers

`Use Apple's default reachability class:

Download reachability project from This link

Copy Reachability.h and Reachability.m file in your project.

And set this method in Application delegate file.

-(void)initializeRechabilityObeserver { //Change the host name here to change the server your monitoring hostReach = [Reachability reachabilityWithHostName: @"www.apple.com http://www.apple.com"]; [hostReach startNotifier]; //[self updateInterfaceWithReachability: hostReach];

internetReach = [Reachability reachabilityForInternetConnection];
[internetReach startNotifier];
//[self updateInterfaceWithReachability: internetReach];

wifiReach = [Reachability reachabilityForLocalWiFi] ;
[wifiReach startNotifier];
//[self updateInterfaceWithReachability: wifiReach];    

}

like image 51
2 revs Avatar answered Nov 16 '22 02:11

2 revs