I need to get a user object, specifically the user email, I will have the user id in this format:
simplelogin:6
So I need to write a function so
simple get the firebaseauth instance. i created one default email and password in firebase. this is only for the security so that no one can get used other than who knows or who purchased our product to use our app. Next step we are providing singup screen for user account creation.
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
String email = user.getEmail();
every time user opens the app, user redirecting to dashboard if current user is not equal to our default email. below is the code
mAuth = FirebaseAuth.getInstance();
if (mAuth.getCurrentUser() != null){
String EMAIL= mAuth.getCurrentUser().getEmail();
if (!EMAIL.equals("example@gmail.com")){
startActivity(new Intent(LoginActivity.this,MainActivity.class));
finish();
}
}
i Am also searching for the same solution finally i got it.