private long ParseNumberAsLong(string originalNumber) { string countryCode; CTTelephonyNetworkInfo info = new CTTelephonyNetworkInfo(); CTCarrier carrier = info.SubscriberCellularProvider; if (carrier != null) { countryCode = carrier.IsoCountryCode.ToUpper(); } else { countryCode = "US"; } PhoneNumberUtil util = PhoneNumberUtil.GetInstance(); PhoneNumber number = util.Parse(originalNumber, countryCode); string normalizedNumber = util.Format(number, PhoneNumberFormat.E164); StringBuilder builder = new StringBuilder(); foreach (char c in normalizedNumber) { if (char.IsDigit(c)) { builder.Append(c); } } return(long.Parse(builder.ToString())); }
private void ProviderUpdatedEvent (CTCarrier carrier) { MonoTouch.CoreFoundation.DispatchQueue.MainQueue.DispatchSync (() => { carrierName = carrier == null ? null : carrier.CarrierName; TableView.ReloadData (); }); }
private void ProviderUpdatedEvent(CTCarrier carrier) { CoreFoundation.DispatchQueue.MainQueue.DispatchSync(() => { carrierName = carrier == null ? null : carrier.CarrierName; TableView.ReloadData(); }); }
public override string GetCountryCodeViaTelephony() { try { string response = CTCarrier.GetIsoCountryCode(); Debug.Log("[GetCountryCodeViaTelephony]. Response: " + (response ?? "null")); return(response); } catch (Exception e) { Debug.Log("[GetCountryCodeViaTelephony]. Error: " + e.Message); return(EEARegionStatus.Unknown.ToString()); } }