Twilio SetIncomingIntent point to Null

113 Views Asked by At

I'm developing an android app for incoming and outgoing calls using Twilio.The outgoing is working fine but while trying with incoming calls i'm getting an error on Null pointer.Can someone help me please.

-able to generate capability token
-able to create device.

MonkeyPhone.java

  protected void setCapabilityToken(String capabilityToken){
    mDevice = Twilio.createDevice(capabilityToken, this /* DeviceListener */);
    Log.i(TAG,"create device ---"+mDevice);
    Log.i(TAG, "create device --- this--" + this);
}

create device ---com.twilio.client.impl.DeviceImpl@2e7a3528
create device --- this--twilio.com.twilioclient.MonkeyPhone@2e7c97a8

-Device gets ready to listen for incoming calls.

MonkeyPhone.java

  public void onInitialized() {
    Log.d(TAG, "Twilio SDK is ready");
    new RetrieveCapabilityToken().execute("/token?client=James");
    Intent intent = new Intent(mContext, MainActivity.class);
    PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    Log.i(TAG, "----Pending Indent-----" + pendingIntent);
    mDevice.setIncomingIntent(pendingIntent);
}

----Pending Indent-----PendingIntent{2e766f54: android.os.BinderProxy@2e79a844}

Now the main Problem comes, setIncomingIntent is pointing to Null.

java.lang.NullPointerException at twilio.com.twilioclient.MonkeyPhone.onInitialized(MonkeyPhone.java:46)

0

There are 0 best solutions below