Tizen Native API
5.0
|
Required Header
#include <phone_number.h>
Overview
The phonenumber utils API provides methods for parsing and formatting phone numbers.
Related Features
This API is related with the following feature:
- http://tizen.org/feature/network.telephony
It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature Element.
Functions | |
int | phone_number_connect (void) |
Connects to the phonenumber-utils service. | |
int | phone_number_disconnect (void) |
Disconnects from the phonenumber-utils service. | |
int | phone_number_get_location_from_number (const char *number, phone_number_region_e region, phone_number_lang_e language, char **location) |
Gets the location string from number, region, and language. | |
int | phone_number_get_formatted_number (const char *number, phone_number_region_e region, char **formatted_number) |
Gets the formatted number. | |
int | phone_number_get_normalized_number (const char *number, char **normalized_number) |
Gets the normalized number. | |
int | phone_number_add_blocking_rule (phone_number_blocking_rule_h rule) |
Adds a blocking rule to the phone number database. | |
int | phone_number_remove_blocking_rule (phone_number_blocking_rule_h rule) |
Removes a blocking rule from the phone number database. | |
int | phone_number_get_blocking_rules (int offset, int limit, phone_number_blocking_rule_h **rules, int *length) |
Retrieves blocking rules as an array. | |
int | phone_number_get_blocking_rules_related (const char *number, phone_number_blocking_rule_h **rules, int *length) |
Retrieves blocking rules that block a specific number. | |
int | phone_number_check_blocking (const char *number, bool *is_blocked) |
Checks if a specific number is blocked or not. | |
int | phone_number_blocking_rule_create (phone_number_blocking_rule_h *rule) |
Creates a blocking rule. | |
int | phone_number_blocking_rule_destroy (phone_number_blocking_rule_h rule) |
Destroys a blocking rule and releases all its resources. | |
int | phone_number_blocking_rule_get_number (phone_number_blocking_rule_h rule, char **number) |
Gets a blocked number from a rule. | |
int | phone_number_blocking_rule_get_match_type (phone_number_blocking_rule_h rule, phone_number_blocking_rule_match_type_e *match_type) |
Gets a rule's match type. | |
int | phone_number_blocking_rule_set_number (phone_number_blocking_rule_h rule, const char *number) |
Sets a blocked number to a rule. | |
int | phone_number_blocking_rule_set_match_type (phone_number_blocking_rule_h rule, phone_number_blocking_rule_match_type_e match_type) |
Sets a rule's match type. | |
Typedefs | |
typedef void * | phone_number_blocking_rule_h |
The blocking rule handle. |
Typedef Documentation
typedef void* phone_number_blocking_rule_h |
The blocking rule handle.
- Since :
- 4.0
Enumeration Type Documentation
enum phone_number_error_e |
Enumeration for phone number errors.
- Since :
- 2.4
- Enumerator:
enum phone_number_lang_e |
Enumeration for language type.
- Since :
- 2.4
- Enumerator:
Enumeration for region type.
- Since :
- 2.4
- Enumerator:
Function Documentation
Adds a blocking rule to the phone number database.
- Since :
- 4.0
- Privilege Level:
- partner
- Privilege:
- http://tizen.org/privilege/blocknumber.write
- Parameters:
-
[in] rule The blocking rule handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
PHONE_NUMBER_ERROR_NONE Successful PHONE_NUMBER_ERROR_INVALID_PARAMETER Invalid parameter PHONE_NUMBER_ERROR_DB_FAILED Database operation failure PHONE_NUMBER_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method. PHONE_NUMBER_ERROR_NOT_SUPPORTED Not supported PHONE_NUMBER_ERROR_IPC Unknown IPC error PHONE_NUMBER_ERROR_OUT_OF_MEMORY Out of memory PHONE_NUMBER_ERROR_SYSTEM Internal error
- Precondition:
- phone_number_connect() should be called to open a connection to the phonenumber-utils service.
- Postcondition:
- phone_number_disconnect() should be called to close a connection to the phonenumber-utils service.
- See also:
- phone_number_remove_blocking_rule()
Creates a blocking rule.
- Since :
- 4.0
- Remarks:
- You must release rule using phone_number_blocking_rule_destroy().
- Parameters:
-
[out] rule The blocking rule handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
PHONE_NUMBER_ERROR_NONE Successful PHONE_NUMBER_ERROR_OUT_OF_MEMORY Out of memory PHONE_NUMBER_ERROR_INVALID_PARAMETER Invalid parameter PHONE_NUMBER_ERROR_NOT_SUPPORTED Not supported PHONE_NUMBER_ERROR_SYSTEM Internal error
- Precondition:
- phone_number_connect() should be called to initialize.
- See also:
- phone_number_blocking_rule_destroy()
Destroys a blocking rule and releases all its resources.
- Since :
- 4.0
- Parameters:
-
[in] rule The blocking rule handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
PHONE_NUMBER_ERROR_NONE Successful PHONE_NUMBER_ERROR_INVALID_PARAMETER Invalid parameter PHONE_NUMBER_ERROR_NOT_SUPPORTED Not supported PHONE_NUMBER_ERROR_SYSTEM Internal error
- See also:
- phone_number_blocking_rule_create()
int phone_number_blocking_rule_get_match_type | ( | phone_number_blocking_rule_h | rule, |
phone_number_blocking_rule_match_type_e * | match_type | ||
) |
Gets a rule's match type.
- Since :
- 4.0
- Parameters:
-
[in] rule The blocking rule handle [out] match_type The match type of blocked number
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
PHONE_NUMBER_ERROR_NONE Successful PHONE_NUMBER_ERROR_INVALID_PARAMETER Invalid parameter PHONE_NUMBER_ERROR_NOT_SUPPORTED Not supported PHONE_NUMBER_ERROR_SYSTEM Internal error
int phone_number_blocking_rule_get_number | ( | phone_number_blocking_rule_h | rule, |
char ** | number | ||
) |
Gets a blocked number from a rule.
- Since :
- 4.0
- Remarks:
- You must release number using free().
- Parameters:
-
[in] rule The blocking rule handle [out] number The blocked number
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
PHONE_NUMBER_ERROR_NONE Successful PHONE_NUMBER_ERROR_INVALID_PARAMETER Invalid parameter PHONE_NUMBER_ERROR_NOT_SUPPORTED Not supported PHONE_NUMBER_ERROR_SYSTEM Internal error
int phone_number_blocking_rule_set_match_type | ( | phone_number_blocking_rule_h | rule, |
phone_number_blocking_rule_match_type_e | match_type | ||
) |
Sets a rule's match type.
- Since :
- 4.0
- Parameters:
-
[in] rule The blocking rule handle [in] match_type The match type of blocked number
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
PHONE_NUMBER_ERROR_NONE Successful PHONE_NUMBER_ERROR_INVALID_PARAMETER Invalid parameter PHONE_NUMBER_ERROR_NOT_SUPPORTED Not supported PHONE_NUMBER_ERROR_SYSTEM Internal error
int phone_number_blocking_rule_set_number | ( | phone_number_blocking_rule_h | rule, |
const char * | number | ||
) |
Sets a blocked number to a rule.
- Since :
- 4.0
- Parameters:
-
[in] rule The blocking rule handle [in] number The blocked number
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
PHONE_NUMBER_ERROR_NONE Successful PHONE_NUMBER_ERROR_INVALID_PARAMETER Invalid parameter PHONE_NUMBER_ERROR_NOT_SUPPORTED Not supported PHONE_NUMBER_ERROR_SYSTEM Internal error
int phone_number_check_blocking | ( | const char * | number, |
bool * | is_blocked | ||
) |
Checks if a specific number is blocked or not.
- Since :
- 4.0
- Privilege Level:
- partner
- Privilege:
- http://tizen.org/privilege/blocknumber.read
- Parameters:
-
[in] number The number to check blocking [out] is_blocked The blocking result
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
PHONE_NUMBER_ERROR_NONE Successful PHONE_NUMBER_ERROR_INVALID_PARAMETER Invalid parameter PHONE_NUMBER_ERROR_DB_FAILED Database operation failure PHONE_NUMBER_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method. PHONE_NUMBER_ERROR_NOT_SUPPORTED Not supported PHONE_NUMBER_ERROR_IPC Unknown IPC error PHONE_NUMBER_ERROR_SYSTEM Internal error
- Precondition:
- phone_number_connect() should be called to open a connection to the phonenumber-utils service.
- Postcondition:
- phone_number_disconnect() should be called to close a connection to the phonenumber-utils service.
int phone_number_connect | ( | void | ) |
Connects to the phonenumber-utils service.
- Since :
- 3.0
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
PHONE_NUMBER_ERROR_NONE Successful PHONE_NUMBER_ERROR_NOT_SUPPORTED Not supported PHONE_NUMBER_ERROR_SYSTEM Internal error
- See also:
- phone_number_disconnect()
int phone_number_disconnect | ( | void | ) |
Disconnects from the phonenumber-utils service.
- Since :
- 3.0
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
PHONE_NUMBER_ERROR_NONE Successful PHONE_NUMBER_ERROR_NOT_SUPPORTED Not supported PHONE_NUMBER_ERROR_SYSTEM Internal error
- See also:
- phone_number_connect()
int phone_number_get_blocking_rules | ( | int | offset, |
int | limit, | ||
phone_number_blocking_rule_h ** | rules, | ||
int * | length | ||
) |
Retrieves blocking rules as an array.
- Since :
- 4.0
- Privilege Level:
- partner
- Privilege:
- http://tizen.org/privilege/blocknumber.read
- Remarks:
- You must release each blocking rule in the array with phone_number_blocking_rule_destroy() and rules using free().
- Parameters:
-
[in] offset The index from which to get results [in] limit The number to limit results (value 0 is used for all blocking rules) [out] rules The array of blocking rule handles [out] length The number of blocking rule handles in the array
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
PHONE_NUMBER_ERROR_NONE Successful PHONE_NUMBER_ERROR_OUT_OF_MEMORY Out of memory PHONE_NUMBER_ERROR_INVALID_PARAMETER Invalid parameter PHONE_NUMBER_ERROR_DB_FAILED Database operation failure PHONE_NUMBER_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method. PHONE_NUMBER_ERROR_NOT_SUPPORTED Not supported PHONE_NUMBER_ERROR_IPC Unknown IPC error PHONE_NUMBER_ERROR_NO_DATA Data does not exist PHONE_NUMBER_ERROR_SYSTEM Internal error
- Precondition:
- phone_number_connect() should be called to open a connection to the phonenumber-utils service.
- Postcondition:
- phone_number_disconnect() should be called to close a connection to the phonenumber-utils service.
int phone_number_get_blocking_rules_related | ( | const char * | number, |
phone_number_blocking_rule_h ** | rules, | ||
int * | length | ||
) |
Retrieves blocking rules that block a specific number.
- Since :
- 4.0
- Privilege Level:
- partner
- Privilege:
- http://tizen.org/privilege/blocknumber.read
- Remarks:
- You must release each blocking rule in the array with phone_number_blocking_rule_destroy() and rules using free().
- Parameters:
-
[in] number The number to get blocking rules related with [out] rules The array of blocking rule handles [out] length The number of blocking rule handles in the array
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
PHONE_NUMBER_ERROR_NONE Successful PHONE_NUMBER_ERROR_OUT_OF_MEMORY Out of memory PHONE_NUMBER_ERROR_INVALID_PARAMETER Invalid parameter PHONE_NUMBER_ERROR_DB_FAILED Database operation failure PHONE_NUMBER_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method. PHONE_NUMBER_ERROR_NOT_SUPPORTED Not supported PHONE_NUMBER_ERROR_IPC Unknown IPC error PHONE_NUMBER_ERROR_NO_DATA Data does not exist PHONE_NUMBER_ERROR_SYSTEM Internal error
- Precondition:
- phone_number_connect() should be called to open a connection to the phonenumber-utils service.
- Postcondition:
- phone_number_disconnect() should be called to close a connection to the phonenumber-utils service.
int phone_number_get_formatted_number | ( | const char * | number, |
phone_number_region_e | region, | ||
char ** | formatted_number | ||
) |
Gets the formatted number.
- Since :
- 2.4
- Remarks:
- You must release formatted_number using free().
- The phonenumber-utils is changed to client/server architecture for performance improvement since 3.0. phone_number_connect()/phone_number_disconnect() should be called.
- Parameters:
-
[in] number The number [in] region The region of number [out] formatted_number The formatted number string to be returned
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
PHONE_NUMBER_ERROR_NONE Successful PHONE_NUMBER_ERROR_OUT_OF_MEMORY Out of memory PHONE_NUMBER_ERROR_INVALID_PARAMETER Invalid parameter PHONE_NUMBER_ERROR_FILE_NO_SPACE_ON_DEVICE FS Full PHONE_NUMBER_ERROR_PERMISSION_DENIED Permission denied PHONE_NUMBER_ERROR_NOT_SUPPORTED Not supported PHONE_NUMBER_ERROR_NO_DATA Requested data does not exist PHONE_NUMBER_ERROR_SYSTEM Internal error
- Precondition:
- phone_number_connect() should be called to open a connection to the phonenumber-utils service. (Since 3.0)
- Postcondition:
- phone_number_disconnect() should be called to close a connection to the phonenumber-utils service. (Since 3.0)
int phone_number_get_location_from_number | ( | const char * | number, |
phone_number_region_e | region, | ||
phone_number_lang_e | language, | ||
char ** | location | ||
) |
Gets the location string from number, region, and language.
- Since :
- 2.4
- Remarks:
- You must release location using free().
- The phonenumber-utils is changed to client/server architecture for performance improvement since 3.0. phone_number_connect()/phone_number_disconnect() should be called.
- Parameters:
-
[in] number The number [in] region The region of number [in] language The language of location [out] location The location string to be returned
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
PHONE_NUMBER_ERROR_NONE Successful PHONE_NUMBER_ERROR_OUT_OF_MEMORY Out of memory PHONE_NUMBER_ERROR_INVALID_PARAMETER Invalid parameter PHONE_NUMBER_ERROR_FILE_NO_SPACE_ON_DEVICE FS Full PHONE_NUMBER_ERROR_PERMISSION_DENIED Permission denied PHONE_NUMBER_ERROR_NOT_SUPPORTED Not supported PHONE_NUMBER_ERROR_NO_DATA Requested data does not exist PHONE_NUMBER_ERROR_SYSTEM Internal error
- Precondition:
- phone_number_connect() should be called to open a connection to the phonenumber-utils service. (Since 3.0)
- Postcondition:
- phone_number_disconnect() should be called to close a connection to the phonenumber-utils service. (Since 3.0)
int phone_number_get_normalized_number | ( | const char * | number, |
char ** | normalized_number | ||
) |
Gets the normalized number.
Normalized number starts with plus('+') and country code, and excludes the separators such as dash or space. It is a format of E.164 standard including the country code based on current network.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/telephony
- Remarks:
- You must release normalized_number using free().
- The phonenumber-utils is changed to client/server architecture for performance improvement since 3.0. phone_number_connect()/phone_number_disconnect() should be called.
- Parameters:
-
[in] number The number [out] normalized_number The normalized number string to be returned
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
PHONE_NUMBER_ERROR_NONE Successful PHONE_NUMBER_ERROR_OUT_OF_MEMORY Out of memory PHONE_NUMBER_ERROR_INVALID_PARAMETER Invalid parameter PHONE_NUMBER_ERROR_PERMISSION_DENIED Permission denied PHONE_NUMBER_ERROR_NOT_SUPPORTED Not supported PHONE_NUMBER_ERROR_NO_DATA Requested data does not exist PHONE_NUMBER_ERROR_SYSTEM Internal error
- Precondition:
- phone_number_connect() should be called to open a connection to the phonenumber-utils service. (Since 3.0)
- Postcondition:
- phone_number_disconnect() should be called to close a connection to the phonenumber-utils service. (Since 3.0)
Removes a blocking rule from the phone number database.
- Since :
- 4.0
- Privilege Level:
- partner
- Privilege:
- http://tizen.org/privilege/blocknumber.write
- Remarks:
- The blocking rule to remove should have been gotten from the phone number database using phone_number_get_blocking_rules().
- Parameters:
-
[in] rule The blocking rule handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
PHONE_NUMBER_ERROR_NONE Successful PHONE_NUMBER_ERROR_INVALID_PARAMETER Invalid parameter PHONE_NUMBER_ERROR_DB_FAILED Database operation failure PHONE_NUMBER_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method. PHONE_NUMBER_ERROR_NOT_SUPPORTED Not supported PHONE_NUMBER_ERROR_IPC Unknown IPC error PHONE_NUMBER_ERROR_OUT_OF_MEMORY Out of memory PHONE_NUMBER_ERROR_SYSTEM Internal error
- Precondition:
- phone_number_connect() should be called to open a connection to the phonenumber-utils service.
- Postcondition:
- phone_number_disconnect() should be called to close a connection to the phonenumber-utils service.
- See also:
- phone_number_add_blocking_rule()