From 5f0598bab7b072bde6cf19d6fb4b477c1045036c Mon Sep 17 00:00:00 2001 From: Jongkyu Koo Date: Fri, 29 Sep 2017 10:53:48 +0900 Subject: [PATCH] Add csharp guide for PhonenumberUtils PS2: Reviewed Change-Id: I7d7f37ebce846c66817b384104ef2dbedd15b199 Signed-off-by: Jongkyu Koo --- org.tizen.guides/html/dotnet/phonenumber-utils.htm | 123 +++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 org.tizen.guides/html/dotnet/phonenumber-utils.htm diff --git a/org.tizen.guides/html/dotnet/phonenumber-utils.htm b/org.tizen.guides/html/dotnet/phonenumber-utils.htm new file mode 100644 index 0000000..d2c59ad --- /dev/null +++ b/org.tizen.guides/html/dotnet/phonenumber-utils.htm @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + Phone Number Management + + + + +
+ +
+

Dependencies

+
    +
  • Tizen 4.0 and Higher
  • +
+

Content

+ +

Related Info

+ +
+
+ +
+ +

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. +
  3. To use the methods and properties of the Tizen.PhonenumberUtils namespace, include it in your application: +
    +using Tizen.PhonenumberUtils;
    +
    +
  4. +
+ + +

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"
+
+ + + +
+ +Go to top + + + + + + + -- 2.7.4