I am getting this exception sometimes when app remains active for long time. Could any one tell,whats the problem ?
Connecting call failed
java.lang.IllegalArgumentException: Account SID cannot be null when making a call
at com.twilio.client.impl.MakeCallCommand.<init>(MakeCallCommand.java:33)
at com.twilio.client.impl.CallControlManager.makeCall(CallControlManager.java:423)
at com.twilio.client.impl.InternalConnectionImpl.connect(InternalConnectionImpl.java:212)
at com.twilio.client.impl.DeviceImpl$2.onCompletion(DeviceImpl.java:339)
at com.twilio.client.impl.MediaManager.onPlayComplete(MediaManager.java:279)
at com.twilio.client.impl.MediaManager.queueSound(MediaManager.java:173)
at com.twilio.client.impl.DeviceImpl.connect(DeviceImpl.java:335)
at com.lola.activities.CallingActivity.connect(CallingActivity.java:199)
at com.lola.activities.CallingActivity.onCreate(CallingActivity.java:92)
at android.app.Activity.performCreate(Activity.java:5122)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2307)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395)
at android.app.ActivityThread.access$600(ActivityThread.java:162)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5371)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
**EDIT : ** here is connect() method called when Call Button is clicked :
public void connect(String fromMobileNo, String phoneNumber)
{
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("frommobileno", fromMobileNo);
parameters.put("mobileno", phoneNumber);
Log.d("parameters", parameters + "");
Log.d(TAG, "device :" + device);
Log.d(TAG, "device :" + device);
if(device == null)
{
Toast.makeText(getApplicationContext(),"Sorry from our side.Please try again.",Toast.LENGTH_LONG).show();
finish();
}
else{
connection = device.connect(parameters, (Controller)getApplication()/* ConnectionListener */);
if (connection == null && ((Controller)getApplication()).basicConnectionListener != null)
((Controller)getApplication()).basicConnectionListener.onConnectionFailedConnecting(new Exception("Couldn't create new connection"));
}
if (connection != null){
Controller.setConnection(connection);
}else {
Log.w(TAG, "Failed to create new connection");
}
}