10-15-2011 07:19 AM
Hi,
I am developing a call log application that is after call disconnected, I fetch the last call details ans send to the server.
But My application shows Error dialog
"Uncaught Exception: Uncaught Exception: net_rim_bb_phone_app(84) is not responding process terminated"
in Blackberry 8310.
I use
public class CallLog implements PhoneListener{
public void callDisconnected(int callId) {
// TODO Auto-generated method stub
PhoneLogs _logs = PhoneLogs.getInstance();
int count=_logs.numberOfCalls(PhoneLogs.FOLDER_NORMAL_ CALLS);
PhoneCallLog phoneLog = (PhoneCallLog)_logs.callAt(count-1,PhoneLogs.FOLDE R_NORMAL_CALLS);
PhoneCallLogID pclID=phoneLog.getParticipant();
//phoneLog.getDate().
String callType="";
if(phoneLog.getType()==PhoneCallLog.TYPE_MISSED_CA LL_OPENED || phoneLog.getType()==PhoneCallLog.TYPE_MISSED_CALL_ UNOPENED) callType="MissedCall Opened";
if(phoneLog.getType()==PhoneCallLog.TYPE_RECEIVED_ CALL) callType="Incoming";
if(phoneLog.getType()==PhoneCallLog.TYPE_PLACED_CA LL){
if(phoneLog.getDuration()>0)
callType="Outgoing";
else
callType="NoAnswer";
}
String callLogString="imei=";
String imei="";
if(DeviceInfo.isSimulator()){
imei+="000000000000000";
callLogString+=imei;
}
else{
imei+=GPRSInfo.imeiToString(GPRSInfo.getIMEI());
callLogString+=imei.substring(0,6)+imei.substring( 7,9)+imei.substring(10,16)+imei.substring(17);
}
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
c.setTime(phoneLog.getDate());
c.setTimeZone(TimeZone.getTimeZone("GMT"));
SimpleDateFormat sdfTime =new SimpleDateFormat("HH:mm:ss");
SimpleDateFormat sdfDate =new SimpleDateFormat("yyyy-MM-dd");
callLogString+="&da="+sdfDate.format(c);
callLogString+="&ti="+sdfTime.format(c);
callLogString+="&ph="+pclID.getNumber();
callLogString+="&type="+callType;
callLogString+="&lat="+lastLat;
callLogString+="&lan="+lastLog;
callLogString+="&b="+DeviceInfo.getBatteryLevel();
callLogString+="&du="+phoneLog.getDuration();
System.out.println(callLogString);
}
}
What is the reason for this error and also let me know the solution for this problem.
10-15-2011 09:16 PM
1) You are running in a Listener.
2) You are not running in your own application, you are actually running in he Phone application. And
3) I suspect this listener is running on the Event Thread.
So that is 3 reasons why you should not attempt to send details to the Server in this code, because:
1) You are blocking this Listener and so any other processing that this Listener might do
2) If you crash, you bring down someone else's application
3) If you block the Event Thread your process will get thrown out with a not responding message.
Instead, capture the details and send them in separate (and non Event Thread) code.
You might want to you save them and then start a Thread to send the data. I would not recommend you do this, because this Thread will be running in the Phone Application. Instead you need to pass this collected data to your application, and have your application send the data to your Server. This means there is very little of your code running in the Phone Application, so less chance of you screwing up the phone - your users won't thank you if you do this!
The best way to get this sort of data to your application for processing is to use a Global Event. have a look at this KB article: