Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package cl.tofcompany.todosenuno.Provider;
- import com.google.android.gms.tasks.Task;
- import com.google.firebase.auth.AuthResult;
- import com.google.firebase.auth.FirebaseAuth;
- import java.util.Objects;
- public class AuthProvider {
- FirebaseAuth mAuth;
- public AuthProvider() {
- mAuth = FirebaseAuth.getInstance();
- }
- public Task<AuthResult> register(String email, String password) {
- return mAuth.createUserWithEmailAndPassword(email, password);
- }
- public Task<AuthResult> login(String email, String password){
- return mAuth.signInWithEmailAndPassword(email , password);
- }
- public void logout(){
- mAuth.signOut();
- }
- public String getId() {return(Objects.requireNonNull(mAuth.getCurrentUser())).getUid();}
- public boolean existSession(){
- boolean exist = false;
- if(mAuth.getCurrentUser()!=null){
- exist = true;
- }
- return exist;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement