Phone Number Management

You can parse, format, and normalize phone numbers. The Tizen.PhonenumberUtils namespace is implemented with the libphonenumber open source library.

The main features of the Tizen.PhonenumberUtils namespace include:

Prerequisites

To enable your application to use the phone number management functionality:

  1. To use the GetNormalizedNumber() method of the Tizen.PhonenumberUtils.PhonenumberUtils class, the application has to request permission by adding the following privilege to the tizen-manifest.xml file:

    <privileges>
       <privilege>http://tizen.org/privilege/telephony</privilege>
    </privileges>
    
  2. To use the methods and properties of the Tizen.PhonenumberUtils namespace, include it in your application:
    using Tizen.PhonenumberUtils;
    

Retrieving Location Information

To retrieve the location from a phone number, use the GetLocationFromNumber() method of the Tizen.PhonenumberUtils.PhonenumberUtils class. Provide the region of the phone number and the language of the returned location string as parameters, using the values defined in the Tizen.PhonenumberUtils.Region and Tizen.PhonenumberUtils.Language enumerations, respectively.

var utils = new PhonenumberUtils();
var location = utils.GetLocationFromNumber("0222550114", Region.Korea, Language.English);
/// Method returns the location string "Seoul"

Formatting Phone Numbers

To format a phone number to use region-specific separators, use the GetFormattedNumber() method of the Tizen.PhonenumberUtils.PhonenumberUtils class, which takes the region parameter as a value of the Tizen.PhonenumberUtils.Region enumeration:

var utils = new PhonenumberUtils();
var formattedNumber = utils.GetFormattedNumber("0222550114", Region.Korea);
/// Method returns the formatted number string "02-2255-0114"

Normalizing Phone Numbers

To retrieve a phone number in a normalized format, use the GetNormalizedNumber() method of the Tizen.PhonenumberUtils.PhonenumberUtils class:

var utils = new PhonenumberUtils();
var normalizedNumber = utils.GetNormalizedNumber("0222550114");
/// Method returns the normalized number string "+821022550114"