@Override
  public void onDestroy() {
    super.onDestroy();

    // Disconnect capability API
    capabilityApi.disconnectApi();
  }
 protected Void doInBackground(Void... unused) {
   try {
     // Refresh all
     api.refreshAllCapabilities();
   } catch (ClientApiException e) {
     // Display error
     Utils.showMessage(RefreshCapabilities.this, getString(R.string.label_refresh_failed));
   }
   return null;
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Set layout
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    setContentView(R.layout.capabilities_refresh);

    // Set title
    setTitle(R.string.menu_refresh_capabilities);

    // Set buttons callback
    Button btn = (Button) findViewById(R.id.refresh_btn);
    btn.setOnClickListener(btnSyncListener);

    // Instanciate contacts API
    capabilityApi = new CapabilityApi(getApplicationContext());
    capabilityApi.addApiEventListener(this);
    capabilityApi.connectApi();
  }