Esempio n. 1
0
        /// <summary>
        /// Creates a PhonenumberUtils.
        /// </summary>
        /// <feature>http://tizen.org/feature/network.telephony</feature>
        /// <exception cref="InvalidOperationException">Thrown when the method failed due to an invalid operation.</exception>
        /// <exception cref="NotSupportedException">Thrown when the feature is not supported.</exception>
        /// <since_tizen> 3 </since_tizen>
        public PhonenumberUtils()
        {
            int ret;

            ret = Interop.PhonenumberUtils.Connect();
            if (ret != (int)PhonenumberUtilsError.None)
            {
                Log.Error(Globals.LogTag, "Failed to connect, Error - " + (PhonenumberUtilsError)ret);
                PhonenumberUtilsErrorFactory.ThrowPhonenumberUtilsException(ret);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the location string from the number, region, and language.
        /// </summary>
        /// <param name="number">The number.</param>
        /// <param name="region">The region of number.</param>
        /// <param name="language">The language of location.</param>
        /// <returns>The location string.</returns>
        /// <feature>http://tizen.org/feature/network.telephony</feature>
        /// <exception cref="InvalidOperationException">Thrown when the method failed due to an invalid operation.</exception>
        /// <exception cref="NotSupportedException">Thrown when the feature is not supported.</exception>
        /// <exception cref="ArgumentException">Thrown when the input coordinates are invalid.</exception>
        /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory.</exception>
        /// <since_tizen> 3 </since_tizen>
        public string GetLocationFromNumber(string number, Region region, Language language)
        {
            int    ret;
            string result;

            ret = Interop.PhonenumberUtils.GetLocationFromNumber(number, (int)region, (int)language, out result);
            if (ret != (int)PhonenumberUtilsError.None)
            {
                Log.Error(Globals.LogTag, "Failed to get location, Error - " + (PhonenumberUtilsError)ret);
                PhonenumberUtilsErrorFactory.ThrowPhonenumberUtilsException(ret);
            }

            return(result);
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the normalized number.
        /// </summary>
        /// <param name="number">The number.</param>
        /// <returns>The normalized number.</returns>
        /// <privilege>http://tizen.org/privilege/telephony</privilege>
        /// <feature>http://tizen.org/feature/network.telephony</feature>
        /// <exception cref="InvalidOperationException">Thrown when the method failed due to an invalid operation.</exception>
        /// <exception cref="NotSupportedException">Thrown when the feature is not supported.</exception>
        /// <exception cref="ArgumentException">Thrown when the input coordinates are invalid.</exception>
        /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory.</exception>
        /// <exception cref="UnauthorizedAccessException">Thrown when the application does not have proper privileges.</exception>
        /// <remarks>
        /// Normalized number starts with plus('+') and country code, and excludes the separators such as dash or space.
        /// It is a format of the E.164 standard including the country code based on the current network.
        /// </remarks>
        /// <since_tizen> 3 </since_tizen>
        public string GetNormalizedNumber(string number)
        {
            int    ret;
            string result;

            ret = Interop.PhonenumberUtils.GetNormailizedNumber(number, out result);
            if (ret != (int)PhonenumberUtilsError.None)
            {
                Log.Error(Globals.LogTag, "Failed to get normalized number, Error - " + (PhonenumberUtilsError)ret);
                PhonenumberUtilsErrorFactory.ThrowPhonenumberUtilsException(ret);
            }

            return(result);
        }