Skip to content

SimpleJnius/sj-firebase-java

Repository files navigation

sj-firebase-java

Build Maven Central MIT Publish Release Publish Snapshot

Port Firebase Java SDK to Python

Usage

Android gradle project

implementation 'io.github.simplejnius:sjfirebase:1.2.0'
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-database'
implementation 'com.google.firebase:firebase-firestore'
implementation 'com.google.firebase:firebase-storage'
implementation 'com.google.firebase:firebase-analytics'

Buildozer Android project

android.gradle_dependencies = io.github.simplejnius:sjfirebase:1.2.0,
    com.google.firebase:firebase-auth,com.google.firebase:firebase-database,
    com.google.firebase:firebase-firestore,com.google.firebase:firebase-storage,
    com.google.firebase:firebase-analytics

Python(Buildozer) installation

# pip
pip install sjfirebase

# buildozer.spec
requirements = sjfirebase

Java API

SJFirebaseAuthEmail

public class com.simplejnius.sjfirebase.SJFirebaseAuthEmail

The entry point of the Firebase Authentication SDK. First, obtain an instance of this class by calling get_instance (NOTE ignore getInstance on firebase documentation).

methods

  • check_user_signed_in
  • get_instance
Visit FirebaseAuth Documentation for more API

SJFirebaseDatabase

public class com.simplejnius.sjfirebase.SJFirebaseDatabase

The entry point for accessing a Firebase Database. You can get an instance by calling getInstance. To access a location in the database and read or write data, use get_ref (NOTE ignore getReference on firebase documentation).

methods

  • get_db
  • get_ref

SJFirebaseFirestore

public class com.simplejnius.sjfirebase.SJFirebaseFirestore

methods

  • get_db

SJFirebaseUser

public class com.simplejnius.sjfirebase.SJFirebaseUser

Represents a user's profile information in your Firebase project's user database. It also contains helper methods to change or retrieve profile information, as well as to manage that user's authentication state. (NOTE ignore getCurrentUser on firebase documentation and use get_current_user).

methods

  • get_current_user
  • profile_change_request_builder
Visit FirebaseUser Documentation for more API

SJFirebaseStorage

public class com.simplejnius.sjfirebase.SJFirebaseStorage

FirebaseStorage is a service that supports uploading and downloading large objects to Google Cloud Storage. Pass a custom instance of [FirebaseApp] (https://firebase.google.com/docs/reference/android/com/google/firebase/FirebaseApp?authuser=0) to get_instance which will initialize it with a storage location (bucket) specified via [setStorageBucket] (https://firebase.google.com/docs/reference/android/com/google/firebase/FirebaseOptions.Builder?authuser=0#setStorageBucket(java.lang.String)).

Otherwise, if you call getReference without a FirebaseApp, the FirebaseStorage instance will initialize with the default FirebaseApp obtainable from getInstance. The storage location in this case will come the JSON configuration file downloaded from the web. (NOTE ignore getInstance on firebase documentation and use get_instance).

methods

  • get_instance