Invoke.invokeApplication( Invoke.APP_TYPE_MESSAGES, args );
}
private void invokePhone( final Object arg ) throws Exception {
PhoneArguments args = null;
if( arg instanceof PhoneArgumentsObject ) {
final PhoneArgumentsObject p = (PhoneArgumentsObject) arg;
final boolean isSmartDialing = p.isSmartDialing();
final int callType = p.getView();
final int lineId = p.getLineId();
if( lineId != PhoneArgumentsConstructor.NO_LINEID && callType == PhoneArgumentsConstructor.VIEW_VOICEMAIL ) {
// net.rim.blackberry.api.phone.Phone does not support using 'voicemail' to get to the device's
// voicemail account, since Invoke.invokeApplication doesn't support line id's, we can't
// handle the case where a developer selects a LINE_ID and wants to call it's specific voicemail.
throw new IllegalArgumentException();
}
String phoneNumber;
if( callType == PhoneArgumentsConstructor.VIEW_VOICEMAIL ) {
phoneNumber = PhoneArguments.VOICEMAIL;
} else {
phoneNumber = p.getDialString();
}
if( phoneNumber == null || phoneNumber.length() == 0 ) {
args = new PhoneArguments();
} else if( lineId != PhoneArgumentsConstructor.NO_LINEID ) {
net.rim.blackberry.api.phone.Phone.initiateCall( lineId, phoneNumber );
return;
} else {
args = new PhoneArguments( PhoneArguments.ARG_CALL, phoneNumber, isSmartDialing );
}
} else {
args = new PhoneArguments();
}
Invoke.invokeApplication( Invoke.APP_TYPE_PHONE, args );
}