Skip to content

Commit

Permalink
ios: carrier name, country code, iso country code
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Vasconcellos committed Oct 9, 2014
1 parent a18b1b7 commit eaa5daf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/ios/Carrier.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ - (void)getCarrierInfo:(CDVInvokedUrlCommand*)command
CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *carrier = [netinfo subscriberCellularProvider];

/* Oi (Carrier Name) */
NSString *carrierNameResult = [carrier carrierName];
/* 724 (MCC) */
NSString *carrierCodeResult = [carrier mobileCountryCode];
/* br (ISO Country Code) */
NSString *carrierCountryResult = [carrier isoCountryCode];

NSString *middleResult = [carrierNameResult stringByAppendingString:@","];
NSString *finalResult = [middleResult stringByAppendingString:carrierCodeResult];
NSString *middleResultOne = [carrierNameResult stringByAppendingString:@","];
NSString *middleResultTwo = [middleResultOne stringByAppendingString:carrierCodeResult];
NSString *middleResultThree = [middleResultTwo stringByAppendingString:@","];
NSString *finalResult = [middleResultThree stringByAppendingString:carrierCountryResult];

CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:finalResult];

Expand Down

0 comments on commit eaa5daf

Please sign in to comment.