Retrieve the phone number of a BlackBerry device

  1. Import the required class.
    import net.rim.blackberry.api.phone.Phone;
  2. Invoke Phone.getDevicePhoneNumber(), passing in true to return the phone number in its regional format.
    String phNumber = Phone.getDevicePhoneNumber(true);
  3. Check for ControlledAccessException to catch instances where your application does not have permission to access the phone number information.
Previous topic: Retrieve call information

Was this information helpful? Send us your comments.