code: public void loginAnonymously(final SimpleLoginAuthenticatedHandler completionHandler) {
        HashMap<String, String> data = new HashMap<String, String>();
        makeRequest(Constants.FIREBASE_AUTH_ANONYMOUS_PATH, data, new RequestHandler() {
  
          public void handle(FirebaseSimpleLoginError error, JSONObject data) {
            if (error != null) {
              completionHandler.authenticated(error, null);
            }
            else {
              try {
                String token = data.has("token") ? data.getString("token") : null;
                if (token == null) {
                  JSONObject errorDetails = data.has("error") ? data.getJSONObject("error") : null;
                  FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(errorDetails);
                  completionHandler.authenticated(theError, null);
                }
                else {
                  JSONObject userData = data.has("user") ? data.getJSONObject("user") : null;
                  if (userData == null) {
                    FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(null);
                    completionHandler.authenticated(theError, null);
                  }
                  else {
                    attemptAuthWithToken(token, Provider.ANONYMOUS, userData, completionHandler);
                  }
                }
              }
              catch (JSONException e) {
                e.printStackTrace();
                FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(null);
                completionHandler.authenticated(theError, null);
              }
            }
          }
  
        });
      }
docs: Login anonymously.
  
  @param completionHandler Handler for asynchronous events.