5
Using the phone application
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
Start the phone application from your BlackBerry Java Application
Use phone call functionality
Listen for phone events
Access and use call logs
Code sample
Task
Steps
Retrieve a phone call.
>
Invoke
Phone.getActiveCall()
.
PhoneCall call = Phone.getActiveCall();
Retrieve the phone number of a
BlackBerry device.
>
Invoke
Phone.getDevicePhoneNumber(boolean format)
.
String phNumber = Phone.getDevicePhoneNumber(true);
Retrieve a phone call by call ID.
>
Invoke
Phone.getCall(int)
.
Summary of Contents for JAVA DEVELOPMENT ENVIRONMENT - - DEVICE APPLICATIONS INTEGRATION - DEVELOPMENT GUIDE
Page 4: ......
Page 7: ......
Page 10: ...10 BlackBerry Device Applications Integration Guide...
Page 12: ...12 BlackBerry Device Applications Integration Guide...
Page 50: ...50 BlackBerry Device Applications Integration Guide...
Page 56: ...56 BlackBerry Device Applications Integration Guide...
Page 65: ......
Page 66: ...2008 Research In Motion Limited Published in Canada...