Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Testing and Deployment

Reply
Contributor
Posts: 18
Registered: ‎07-24-2012
My Device: Bold 9650
My Carrier: Unicom

How can I get incoming call number with BB10 native API

How can I get incoming call number with BB10 native API? I have gone through the APIs, but still have no idea. Thanks.

Developer
Posts: 434
Registered: ‎07-23-2012
My Device: Blackberry 10
My Carrier: Orange

Re: How can I get incoming call number with BB10 native API

check with PhoneListener.

Thanks
-------------------------------------------------------------------------------------
Press the Accept as solution Button when u got the Solution
Press Kudo to say thank to developer.
-------------------------------------------------------------------------------------.
Contributor
Posts: 18
Registered: ‎07-24-2012
My Device: Bold 9650
My Carrier: Unicom

Re: How can I get incoming call number with BB10 native API

It is a Java interface from BB Java OS. Is it applicable on BB 10 device?

Developer
Posts: 434
Registered: ‎07-23-2012
My Device: Blackberry 10
My Carrier: Orange

Re: How can I get incoming call number with BB10 native API

Sorry it won't work on BB10. check adobe air api of playbook that will work on bb10 (once we will get the actual SDK but not now).

Thanks
-------------------------------------------------------------------------------------
Press the Accept as solution Button when u got the Solution
Press Kudo to say thank to developer.
-------------------------------------------------------------------------------------.
New Developer
Posts: 48
Registered: ‎08-06-2012
My Device: Blacberry 10 Dev Alpha
My Carrier: Blackberry

Re: How can I get incoming call number with BB10 native API

It doesn't work for BB10

Developer
Posts: 671
Registered: ‎03-21-2012
My Device: BlackBerry PlayBook 16GB
My Carrier: Vip

Re: How can I get incoming call number with BB10 native API

Phone API from latest BB 10 Beta2 SDK, but is's a bit incomplete :smileysad:

 

/**
 * @file number.h
 *
 * Copyright (c) Research In Motion Limited. All rights reserved.
 *
 * @brief Phone number utility functions.
 *
 * To retrieve the options associated with the phone you can use the
 * convenience method phone_number_get_options() but this call is expensive
 * and intended for infrequent use only.  If you need to monitor these
 * options the recommended approach is to use phone_number_open_options() to
 * get an FD to the options PPS object.  You then wait for changes on this
 * FD and call phone_number_update_options() to have your config structure
 * updated with the changes in the PPS object.  Use phone_number_close_options()
 * when you are done.
 */

#ifndef _PHONE_NUMBER_H_
#define _PHONE_NUMBER_H_

#include <stdbool.h>

__BEGIN_DECLS

/** Types & Definitions **/

#define PHONE_NUMBER_LENGTH    (80)

/**
 * @typedef phone_number_t Holds a phone number
 */
typedef char phone_number_t[PHONE_NUMBER_LENGTH];

/**
 * @typedef phone_sig_t signature of a phone number - all numbers that are
 *  equal will have the same signature
 */
typedef char phone_sig_t[PHONE_NUMBER_LENGTH];

/**
 * @typedef phone_number_options_t Contains all parameters connected to
 * phone numbers
 */
typedef struct {
    int country_code; /* Code for region being called from (North
                       * America is 1) */
    char area_code[PHONE_NUMBER_LENGTH]; /* Default area code */
    int national_number_length; /* Length of a phone number in the region */
    phone_number_t corp_number; /* Corporate switchboard number */
    int corp_wait; /* how long to wait before dialing outside extensions */
    int corp_ext_len; /* Length of a corporate extension */
    int corp_ext_wait; /* How long to wait before dialing corporate extension */
} phone_number_options_t;

/** API Function Prototypes **/

/**
 * @brief Open the phone options pps object with "wait,delta"
 *
 * @return file descriptor to the PPS object
 */
int
phone_number_open_options(void);

/**
 * @brief Closes the phone options pps object FD
 * @param[in] fd
 *
 * @return Returns void.
 */
void
phone_number_close_options(int fd);

/**
 * @brief When a delta is received, call this function to update your
 *  local copy of the config
 *
 * @param[out] config  input configuration to be modified
 * @param[in] readBuffer  Delta Buffer given
 * @return True if successful
 */
bool
phone_number_update_options(phone_number_options_t *config, char *read_buf);

/**
* @brief Opens the phone options PPS object and uses it to populate the
*  config structure.
* @warning This is an expensive call - meant for infrequent usage.
*
* @param[out] config input configuration to be modified
* @return True if successful
*/
bool
phone_number_get_options(phone_number_options_t *config);

/**
* @brief Convenience method that returns the size of the config structure.
*
* @return sizeof the phone_number_options_t structure
*/
int
phone_number_sizeof_options(void);

/**
 *  Convert phone number to international form using the Smart Dialing Options.
 *
 *  This algorithm is able to detect phone numbers in the following patterns:
 *     NDD AC LOCAL
 *         AC LOCAL
 *            LOCAL
 *
 *  and convert them to the standard form:
 *    +CC AC LOCAL
 *
 *  @param[in] config The smart dialing options
 *  @param[in] original_number The raw number to be converted
 *  @param[out] converted_number The converted number.
 *  @return true if smart dialing was applied successfully
 */
bool
phone_number_apply_smart_dialing(const phone_number_options_t *config,
                                 const phone_number_t original_number,
                                 phone_number_t converted_number);

/**
 * @brief Takes a phone number as an input and returns a number formatted for
 * transmission (extra characters removed, smart dialing optionally applied,
 * "+1 (519) 888 7465" becomes "15198887465").
 * @param[in] config Options that control smart dialing
 * @param[in] inNumber The input for the formatted number
 * @param[out] outNumber The string where the converted output will go
 * @param[in] smart_dial true if smart dialing is to be applied
 * @return true if formatting was successful
*/
bool
phone_number_format_for_transmission(const phone_number_options_t *config,
                                     const phone_number_t inNumber,
                                     phone_number_t outNumber, bool smart_dial);

/**
 *  @brief Converts the two numbers to a canonical format (format for
 *  transmission) and then compares them.
 *
 * @param[in] config The smart dialing options
 * @param[in] first_number First number to compare
 * @param[in] second_number Second Number to compare.
 *
 * @return true if the numbers are the same
 */
bool
phone_number_compare(const phone_number_options_t *config,
                     const phone_number_t first_number,
                     const phone_number_t second_number);

/**
 * @brief Takes the input phone number, and formats it like a phone number
 * based on the home country code ("15198887465" becomes "+1 (519) 888 7465").
 * @param[in] config The smart dialing settings to use for the comparison
 * @param[in] input_number The number to format
 * @param[out] output_number The formatted number
 * @return true if formatting was successful
*/
bool
phone_number_format_for_display(const phone_number_options_t *config,
                                const phone_number_t input_number,
                                phone_number_t output_number);

/**
 * @brief Calculates a phone number's signature using the configured
 * smart dialing settings. All numbers that are considered 'equal'  within the
 * context of the options (such as 8887465, 5198887465, +15198887465) will
 * map to the same signature.
 *
 * @param[in] config The smart dialing options
 * @param[in] number number to calculate signature for
 * @param[out] signature signature of number provided
 *
 * @return true if valid signature was generated
 */
bool
phone_number_get_signature(const phone_number_options_t *config,
                           const phone_number_t number, phone_sig_t signature);

/**
 * @brief Compares two phone number signatures for equality.  This is a
 *  string compare of the signatures with tests for NULL.
 *
 * @param[in] sig1  First signature to compare
 * @param[in] sig2  Second signature to compare
 *
 * @return true if signatures are equal.
 */
bool
phone_number_compare_signatures(phone_sig_t sig1, phone_sig_t sig2);

/**
 * @brief Formats a phone number to replace all the digits with 'x' except for
 * the first 4 digits and the last 2 digits
 *
 * @param[in] input_number The number to format
 * @param[out] output_number A buffer to store the output in.
 *
 * @return true if obfuscation was successful
 */
bool
phone_number_obfuscate(const phone_number_t input_number,
                       phone_number_t output_number);

__END_DECLS

#endif /* _PHONE_NUMBER_H_ */

 

Contributor
Posts: 18
Registered: ‎07-24-2012
My Device: Bold 9650
My Carrier: Unicom

Re: How can I get incoming call number with BB10 native API

Hopefullly there is a release of complete dev environmenn as soon as possible. :Flowers:

New Contributor
Posts: 2
Registered: ‎06-27-2013
My Device: BBZ10 Dev Alpha
My Carrier: O2

Re: How can I get incoming call number with BB10 native API

How do I include this in my project. I have just upgraded to 10.2 and this looks useful. However - I cant find any documentation on this and I get an error when attempting to include it in the project.