Java Driver for Firebase

I just started a new Project @ GitHub, called jfirebase. That is basically a Java Wrapper for the REST API of Firebase. Clone the git repo and build the package with Maven2 / Maven3 like this:

mvn -Dmaven.test.skip=true package

There are Unit Tests for the project but If you want to run the test cases you have to add your firebase channel to the test classes.

You can install the JAR file with this command into your local Maven Repository:

mvn -Dmaven.test.skip=true install

The Driver contains basically 5 methods to interact with Firebase.

  • boolean write(Map<String, String> map)
  • Reader read(String uri)
  • boolean delete(String uri)
  • void setChannel(String channel)
  • String setKey(String key)

Here is an example for writing data to Firebase.

Map data = new HashMap();
data.put("firstname", "Robert");
data.put("lastname", "Reiz");
IDriver driver = new Driver();

Your channel would be something like: “;.

OK. Here is an example for reading data.

IDriver driver = new Driver();
Reader reader ="users/jack");
   ObjectMapper mapper = new ObjectMapper();
   User user = mapper.readValue(reader, User.class);
} catch (Exception ex){

The “read” method returns a “”. With that you can do what you want. I am using here the jackson-core-lgpl JSON Mapper to map the JSON String from Firebase to my Java class User.

The delete method is pretty straight forward:

IDriver driver = new Driver();
boolean deleted = driver.delete("user/jack");

Let me know if you have questions.

9 thoughts on “Java Driver for Firebase

  1. Thanks for building this. I had a little trouble getting it to work in the beginning but It is smooth sailing now. What else are you planning to do with the firebase project?

    • Hey Ryan. Good question. I didn’t look at the firebase project since round about 6 weeks. Just because I am to busy with the project. And your are the first one who is giving me feedback to this firebase driver.
      If you have any change requests or bugs, than I will continue to work on this project. Your feedback is appreciated.

  2. How do you auth?
    ref.authWithPassword(“”, “fbozana129”, new Firebase.AuthResultHandler() {
    public void onAuthenticated(AuthData authData) {
    try {
    } catch (Throwable e) {
    public void onAuthenticationError(FirebaseError er) {

    Also, I may also try

  3. Hi Rob,

    Reading your blog post spawned the idea to also write a Java wrapper for the Firebase REST API, which attempts to be a bit closer to their Java and Javascript SDKs.

    It’s called rest-on-fire and is available over jCenter and Maven Central. Thought I mention it here as a possible alternative. More details can be found on my github repository (


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s