/**
   * ******************************************************** shows BlinkUpPlugin activity and
   * handles appropriate callbacks ********************************************************
   */
  private void presentBlinkUp(Activity activity, BlinkupController controller) {

    // show toast if can't acquire token
    final BlinkupController.TokenAcquireCallback tokenAcquireCallback =
        new BlinkupController.TokenAcquireCallback() {
          @Override
          public void onSuccess(String planId, String id) {}

          @Override
          public void onError(String s) {
            Log.e(TAG, s);
          }
        };

    // send back error if connectivity issue
    BlinkupController.ServerErrorHandler serverErrorHandler =
        new BlinkupController.ServerErrorHandler() {
          @Override
          public void onError(String s) {
            BlinkUpPluginResult.sendPluginErrorToCallback(ERROR_VERIFY_API_KEY_FAIL);
          }
        };

    // load cached planId if available. Otherwise, SDK generates new one automatically
    // see electricimp.com/docs/manufacturing/planids/ for info about planIDs
    if (!mGeneratePlanId) {
      if (org.apache.cordova.BuildConfig.DEBUG && !TextUtils.isEmpty(mDeveloperPlanId)) {
        controller.setPlanID(mDeveloperPlanId);
      } else {
        String planId = PreferencesHelper.getPlanId(activity);
        controller.setPlanID(planId);
      }
    }

    controller.acquireSetupToken(activity, mApiKey, tokenAcquireCallback);
    controller.selectWifiAndSetupDevice(activity, mApiKey, serverErrorHandler);
  }