01-28-2010 09:38 AM - last edited on 01-28-2010 09:45 AM
hi, I've developed an app that generates a call through code:
PhoneArguments pa = new PhoneArguments(PhoneArguments.ARG_CALL, newNumber);
Invoke.invokeApplication(Invoke.APP_TYPE_PHONE, pa);
it works in previous version simulators and even in 9530, but in 9500 when the new number is dialed, it hangs up immediately.As a matter of fact, it goes to callDisconnected(int callId) method. Any thoughts?
thanx
Solved! Go to Solution.
02-01-2010 01:55 PM
What BlackBerry device software version are you testing on? You can find this under Options, About on the BlackBerry Smartphone. Does this also occur when creating a call using the Phone application?
Try running the clean.bat file located in the simulator directory to reset the simulator back to its default state.
02-05-2010 05:26 PM
thanx for answering....the version is 5.0.0.252 and using the Phone application works fine,and even after running clean.bat it's still hanging up the second number...I'm using net.rim.eide.componentpack4.5.0_4.5.0.16...but it works on 9530, that's weird.., my boss wants to try it on the Storm model, that is 9500 and 9530, right?
thanx
02-08-2010 02:08 PM
I tried the same BlackBerry Smartphone simulator, but was unable to reproduce this. Do you get a dialog box when you attempt the phone call? What Windows OS are you using?
You have the model numbers correct. The BlackBerry 9500 and 9530 both refer to the Storm. The BlackBerry Storm 2 is the 9550.
02-09-2010 05:26 PM
no alert box., just the display shows Call Disconnected....I'm using Windows Seven 32bits...what OS did you try it on?...thanx
02-09-2010 09:28 PM
also tried it on XP 32bits and same thing
02-10-2010 08:06 AM
i'll post my code:
/**
*
*/
package com.blackberry.test;
import java.util.Enumeration;
import javax.microedition.pim.Contact;
import javax.microedition.pim.ContactList;
import javax.microedition.pim.PIM;
import javax.microedition.pim.PIMException;
import javax.microedition.pim.PIMItem;
import net.rim.blackberry.api.invoke.Invoke;
import net.rim.blackberry.api.invoke.PhoneArguments;
import net.rim.blackberry.api.pdap.BlackBerryContactList;
import net.rim.blackberry.api.phone.Phone;
import net.rim.blackberry.api.phone.PhoneCall;
import net.rim.blackberry.api.phone.PhoneListener;
import net.rim.device.api.system.EventInjector;
import net.rim.device.api.ui.Keypad;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.container.MainScreen;
public class Test extends UiApplication {
public static void main(String[] args) {
Test theApp = new Test();
theApp.enterEventDispatcher();
}
public Test() {
pushScreen(new Express());
}
}
class Express extends MainScreen implements PhoneListener {
private boolean is111 = false;
private static String number = "111";
private static String newNumber = "222";
public Express() {
super();
Phone.addPhoneListener(this);
}
public void callEndedByUser(int callId) {
if (is111) {
PhoneArguments phoneCallArgs = new PhoneArguments(
PhoneArguments.ARG_CALL, newNumber);
Invoke.invokeApplication(Invoke.APP_TYPE_PHONE, phoneCallArgs);
is111 = false;
}
}
public void callInitiated(int callId) {
PhoneCall call = Phone.getCall(callId);
String c = (String) call.getDisplayPhoneNumber();
String call2 = "";
for (int i = 0; i < c.length(); i++) {
if (Character.isDigit(c.charAt(i))) {
call2 += c.charAt(i);
}
}
if (call2.equalsIgnoreCase(number)) {
is111 = true;
EventInjector.KeyCodeEvent ev = new EventInjector.KeyCodeEvent(
EventInjector.KeyCodeEvent.KEY_DOWN, (char) Keypad.KEY_END,
0);
EventInjector.KeyCodeEvent ev2 = new EventInjector.KeyCodeEvent(
EventInjector.KeyCodeEvent.KEY_UP, (char) Keypad.KEY_END, 0);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
EventInjector.invokeEvent(ev);
EventInjector.invokeEvent(ev2);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
02-10-2010 09:32 AM
Is your callInitiated method firing its events? If so, it could be hanging up the call before the simulator incoming call prompt appears.
02-10-2010 10:08 AM - last edited on 02-10-2010 10:12 AM
that's the methodI thought should fire the event ...how should it be done?...could you mend my code?...thanx
02-11-2010 06:49 PM
that was exactly was going on, it was entering callInitiated method twice before changing the display number and therefore hanging up. I added a flag to ensure it'll enter only once per call redirection. any better solution? Thanx for the ideas...