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, follow these steps:

  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:

    XML
    Copy
    <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:

    C#
    Copy
    using Tizen.PhonenumberUtils;

Retrieve 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:

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

Format 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:

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

Normal phone numbers

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

C#
Copy
var utils = new PhonenumberUtils(); var normalizedNumber = utils.GetNormalizedNumber("0222550114"); /// Method returns the normalized number string "+821022550114"
  • Dependencies
    • Tizen 4.0 and Higher
Telephony Information
Next Text Input and Voice
Submit your feedback to GitHub