Pavan Alapati
Pavan Alapati

Reputation: 65

open some link when my wifi connected in my iPhone mobile

We need when wifi connected in iPhone mobile.We need open app-story in browser automatically.i.e We have 4 wifi's Himansu,hits,poll,hotspot.We need When wifi connect Humans after connected it's redirect to below link

https://itunes.apple.com/in/app/facebook/id284882215?mt=8

Please give me any idea.First tell me it's possible or not

Upvotes: 2

Views: 235

Answers (1)

Anbu.Karthik
Anbu.Karthik

Reputation: 82779

Using the code apple provide here

Reachability *reach = [Reachability reachabilityForInternetConnection];
[reach startNotifier];

NetworkStatus status = [reach currentReachabilityStatus];

if(status == NotReachable) 
{
    //No internet
}
else if (status == ReachableViaWiFi)
{
    //WiFi
         [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://itunes.apple.com/in/app/facebook/id284882215?mt=8"]];

}
else if (status == ReachableViaWWAN) 
{
    //3G
     [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://itunes.apple.com/in/app/facebook/id284882215?mt=8"]];
}

getting Wifi network Name

Step 1:

import the framework #import <SystemConfiguration/CaptiveNetwork.h>

Step -2

implement the method in 

     CFArrayRef myArray = CNCopySupportedInterfaces();
    CFDictionaryRef myDict =   CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));

   NSLog(@"Connected at:%@",myDict);
   NSDictionary *myDictionary = (__bridge_transfer   NSDictionary*)myDict;

   NSString *  SSID = [myDictionary objectForKey:@"SSID"];
   NSLog(@"bssid is %@", SSID);

  // your console output is just like 
   SSID = "Eqra'aOrange";

Step - 3

  now you check your condition 

    if ([SSID isEqualToString:@"Himansu"])
    {
      // customize your code
     }
    else
     {
     // do your stuff
    }

Upvotes: 4

Related Questions