/* Twilio.InitListener method */
  @Override
  public void onInitialized() {
    Log.v(LOGTAG, "Twilio SDK is Initialized");
    try {
      Log.v(LOGTAG, "Auth URL: " + appContext.getString(R.string.twilio_auth_url));
      String capabilityToken = HttpHelper.httpGet(appContext.getString(R.string.twilio_auth_url));

      Log.v(
          LOGTAG,
          appContext.getString(R.string.twilio_auth_url) + " Auth Token: " + capabilityToken);
      device = Twilio.createDevice(capabilityToken, null /* DeviceListener */);
      Log.v(LOGTAG, "Created Twilio Device");
    } catch (Exception e) {
      Log.e(LOGTAG, "Failed to obtain capability token: " + e.toString());
    }
  }
Ejemplo n.º 2
0
 private void getCapabilityToken(String url, PendingIntent intent) {
   this.capabilityToken = null;
   this.device = null;
   try {
     this.pendingIntent = intent;
     this.capabilityToken = HttpHelper.httpGet(url);
     this.device = Twilio.createDevice(this.capabilityToken, null);
     Log.d(TAG, this.capabilityToken);
     if (this.pendingIntent != null) {
       Log.d(TAG, "setting pending intent");
       device.setIncomingIntent(pendingIntent);
     } else {
       Log.d(TAG, "incoming call unavailable");
     }
   } catch (Exception e) {
     Log.e(TAG, "Failed to obtain capability token: " + e.getLocalizedMessage());
   }
 }