@Kroll.method(runOnUiThread = true)
  public void registerUser(HashMap args) throws Exception {
    final KrollProxy that = this;

    KrollDict options = new KrollDict(args);
    final KrollFunction successCallback = getCallback(options, "success");
    final KrollFunction cancelCallback = getCallback(options, "error");

    username = (String) getProperty("username");
    realm = (String) getProperty("realm");

    XPS xps = new XPS(this.getActivity());
    WPSAuthentication auth = new WPSAuthentication(username, realm);

    RegistrationCallback regCallback =
        new RegistrationCallback() {
          HashMap<String, String> callbackDict = new HashMap<String, String>();

          public void handleSuccess() {
            // Indicates that registration has been successful
            Log.d(LCAT, "Registration Successfull!");
            successCallback.callAsync(that.getKrollObject(), callbackDict);
          }

          public WPSContinuation handleError(final WPSReturnCode error) {
            // Indicates that registration has failed, along with the error code.
            // Return continue to keep trying, stop to give up.
            callbackDict.put("success", "false");
            callbackDict.put("error", error.toString());

            return WPSContinuation.WPS_CONTINUE;
          }

          public void done() {
            // Indicates that registration is completed.
            // If you call abort() during registration, done() will be
            // called without either handle method being called.
          }
        };
    xps.registerUser(auth, null, regCallback);
  }
  // @Kroll.getProperty
  @Kroll.method(runOnUiThread = true)
  public void skyhookLocation(HashMap args) throws Exception {
    final KrollProxy that = this;

    KrollDict options = new KrollDict(args);
    final KrollFunction successCallback = getCallback(options, "success");
    final KrollFunction cancelCallback = getCallback(options, "error");

    username = (String) getProperty("username");
    realm = (String) getProperty("realm");

    Log.d(LCAT, "START WPSLocation");
    // Create the authentication object
    // myAndroidContext must be a Context instance
    XPS xps = new XPS(this.getActivity());
    WPSAuthentication auth = new WPSAuthentication(username, realm);

    // Callback object
    WPSLocationCallback callback =
        new WPSLocationCallback() {
          HashMap<String, String> callbackDict = new HashMap<String, String>();

          // What the application should do after it's done
          public void done() {
            // after done() returns, you can make more WPS calls.
            Log.d(LCAT, "WPSLocation DONE : ");
          }

          // What the application should do if an error occurs
          public WPSContinuation handleError(WPSReturnCode error) {
            // handleWPSError(error); // you'll implement handleWPSError()
            Log.d(LCAT, "error : " + error);

            callbackDict.put("success", "false");
            callbackDict.put("error", error.toString());

            // To retry the location call on error use WPS_CONTINUE,
            // otherwise return WPS_STOP
            cancelCallback.callAsync(that.getKrollObject(), callbackDict);

            return WPSContinuation.WPS_STOP;
          }

          // Implements the actions using the location object
          public void handleWPSLocation(WPSLocation location) {

            Log.d(LCAT, "location.getLatitude: " + location.getLatitude());
            Log.d(LCAT, "location.getLongitud: " + location.getLongitude());

            callbackDict.put("success", "true");
            callbackDict.put("streetAddress", location.getStreetAddress() + "");
            callbackDict.put("latitude", location.getLatitude() + "");
            callbackDict.put("longitude", location.getLongitude() + "");

            successCallback.callAsync(that.getKrollObject(), callbackDict);
          }
        };

    // Call the location function with callback
    xps.getLocation(auth, WPSStreetAddressLookup.WPS_FULL_STREET_ADDRESS_LOOKUP, callback);
  }