问题
I am trying to make a call by altering android HelloMonkey for a few days using valid userid, when i make a call i get an error "Account SID cannot be null when making a call" my code is like
public void connect(String phoneNumber) {
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("PhoneNumber", phoneNumber);
if (device == null){
Log.w("", "Failed device == null");
}else{
Log.w("", "device != null");
}
connection = device.connect(parameters, null /* ConnectionListener */);
if (connection == null)
Log.w(TAG, "Failed to create new connection");
}
nothing is found null
Please help. Thanks in advance
回答1:
Instead of using key name as "PhoneNumber", use "To" as key to the Map parameters.
public void connect(String phoneNumber) {
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("To", phoneNumber);
connection = device.connect(parameters, null /* ConnectionListener */);
if (connection == null)
Log.w(TAG, "Failed to create new connection");
}
Twilio Client for android
来源:https://stackoverflow.com/questions/26472521/android-twilio-make-a-call