Twilio android客户端中未调用挂起的意图
我正在使用Twilio中的示例进行语音通话。我可以从android客户端拨打外呼。但无法接收任何来电。呼叫在我的服务器和twilio之间正确路由,甚至显示在呼叫日志中,但未调用活动。有人能帮帮我吗?我想这件事有点问题 //MonkeyPhone.javaTwilio android客户端中未调用挂起的意图,android,twilio,android-pendingintent,Android,Twilio,Android Pendingintent,我正在使用Twilio中的示例进行语音通话。我可以从android客户端拨打外呼。但无法接收任何来电。呼叫在我的服务器和twilio之间正确路由,甚至显示在呼叫日志中,但未调用活动。有人能帮帮我吗?我想这件事有点问题 //MonkeyPhone.java public void onInitialized() { Log.d(TAG, "Twilio SDK is ready"); try { capabilityToken
public void onInitialized() {
Log.d(TAG, "Twilio SDK is ready");
try {
capabilityToken = HttpHelper.httpGet("http://my server/token?client=jenny");
device = Twilio.createDevice(capabilityToken, this);
Intent intent = new Intent(context, HelloMonkeyActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
intent, PendingIntent.FLAG_UPDATE_CURRENT);
device.setIncomingIntent(pendingIntent);
} catch (Exception e) {
Log.e(TAG,"Failed to obtain capability token: "+ e.getLocalizedMessage());
}
}
//HelloMonkeyActivity.java
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
}
@Override
protected void onResume() {
super.onResume();
Intent intent=getIntent();
Device device=intent.getParcelableExtra(Device.EXTRA_DEVICE);
Connection connection= intent.getParcelableExtra(Device.EXTRA_CONNECTION);
Log.i("Hello monkey", "device and connection are:"+device+":"+connection);
if(device!=null && connection!=null){
intent.removeExtra(Device.EXTRA_DEVICE);
intent.removeExtra(Device.EXTRA_CONNECTION);
phone.handleIncomingConnections(device, connection);
}
}
你解决了你的问题还是我应该帮助你?我解决了我的问题@anshul Tyagi你能帮我吗@akshay@AnshulTyagi....my问题是,该设备是通过Twilio.createDevice(capabilityToken,this)创建为null的;方法。作为applicationContext的此参数的值为null。将当前上下文传递给此方法,解决了问题哦,我们使用它进行调用。我也面对这个问题2天,但我得到了解决方案的文件。你实现了来电的代码吗?