Using the phone application
Start the phone application from your BlackBerry Java Application
Use phone call functionality
Listen for phone events
Access and use call logs
Code sample
Start the phone application from your BlackBerry Java
Application
To open the phone application from your BlackBerry® Java® Application, invoke
Invoke.invokeApplication(APP_TYPE_PHONE,PhoneArguments)
The following excerpt from the Restaurants.java code sample on page 69 creates a menu item that invokes the
phone application to call a restaurant.
private MenuItem phoneItem = new MenuItem(_resources.getString(MENUITEM_PHONE), 110, 12) {
public void run() {
synchronized(store) {
String phoneNumber = phonefield.getText();
if ( phoneNumber.length == 0 ) {
Dialog.alert(_resources.getString(ALERT_NO_PHONENUMBER));
} else {
PhoneArguments call = new PhoneArguments(PhoneArguments.ARG_CALL, phoneNumber);
Invoke.invokeApplication(Invoke.APP_TYPE_PHONE, call);
}
}
}
};
Use phone call functionality
Task
Retrieve a phone call.
Retrieve the phone number of a
BlackBerry device.
Retrieve a phone call by call ID.
Steps
Phone.getActiveCall()
>
Invoke
PhoneCall call = Phone.getActiveCall();
Phone.getDevicePhoneNumber(boolean format)
>
Invoke
String phNumber = Phone.getDevicePhoneNumber(true);
Phone.getCall(int)
>
Invoke
.
.
.
5
.