Working with Firebase in Android: Real-time Database and Authentication
Working with Firebase in Android: Real-time Database and Authentication
Firebase offers real-time databases and authentication services for Android apps. Here’s how to get started:
Firebase Authentication Example:
FirebaseAuth mAuth = FirebaseAuth.getInstance();
mAuth.signInWithEmailAndPassword(email, password)
.addOnCompleteListener(this, task -> {
if (task.isSuccessful()) {
// Sign in success
} else {
// Sign in failure
}
});
Firebase Realtime Database Example:
DatabaseReference database = FirebaseDatabase.getInstance().getReference();
User user = new User("John Doe", "john@example.com");
database.child("users").push().setValue(user);
Comments
Post a Comment