use of com.google.firebase.auth.FirebaseUser in project BloodHub by kazijehangir.
the class SplashActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_screen);
mAuth = FirebaseAuth.getInstance();
FirebaseUser currentUser = mAuth.getCurrentUser();
if (currentUser != null) {
setView(currentUser.getUid(), currentUser.getEmail());
} else {
setContentView(R.layout.activity_fscreen);
Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(SplashActivity.this, EmergencyRequestActivity.class);
startActivity(intent);
}
});
Button button1 = (Button) findViewById(R.id.button2);
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(SplashActivity.this, LoginActivity.class);
startActivity(intent);
}
});
}
}
use of com.google.firebase.auth.FirebaseUser in project Quizly by sebastianjs12.
the class StudentHomepage method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.student_homepage);
firebaseAuth = FirebaseAuth.getInstance();
if (firebaseAuth.getCurrentUser() == null) {
finish();
Intent i = new Intent(StudentHomepage.this, MainActivity.class);
startActivity(i);
}
FirebaseUser user = firebaseAuth.getCurrentUser();
textViewStudentEmail = (TextView) findViewById(R.id.textViewStudentEmail);
textViewStudentEmail.setText("Welcome " + user.getDisplayName());
}
use of com.google.firebase.auth.FirebaseUser in project Firebase-Helper by AtifAbbAsi19.
the class FireBaseHelper method deleteFirebaseUserAuthAccount.
public static void deleteFirebaseUserAuthAccount(Context context, String email, String password) {
final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
// Get auth credentials from the user for re-authentication. The example below shows
// email and password credentials but there are multiple possible providers,
// such as GoogleAuthProvider or FacebookAuthProvider.
AuthCredential credential = EmailAuthProvider.getCredential(email, password);
// Prompt the user to re-provide their sign-in credentials
user.reauthenticate(credential).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
user.delete().addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
// Log.d(LOG_TAG, "User account deleted.");
}
}
});
}
});
}
use of com.google.firebase.auth.FirebaseUser in project UniPool by divya21raj.
the class LoginActivity method dummyInitFinalCurrentUser.
private void dummyInitFinalCurrentUser(FirebaseUser user) throws ParseException {
HashMap<String, Float> dummyLambdaMap = new HashMap<>();
dummyLambdaMap.put("123", 0f);
GenLocation dummyGenLocation = new GenLocation("dummy", "dummy", 0d, 0d);
TripEntry dummyTripEntry = new TripEntry("dummy", "dummyId", "DummyUser", "12:00", "1/11/12", dummyGenLocation, dummyGenLocation, dummyLambdaMap);
HashMap<String, TripEntry> dummyUserEntries = new HashMap<>();
dummyUserEntries.put("dummy", dummyTripEntry);
HashMap<String, TripEntry> dummyRequestSent = new HashMap<>();
dummyRequestSent.put(dummyTripEntry.getEntry_id(), dummyTripEntry);
ArrayList<String> dummyUserIdList = new ArrayList<>();
dummyUserIdList.add("dummy");
HashMap<String, ArrayList<String>> dummyRequestReceived = new HashMap<>();
dummyRequestReceived.put("dummy", dummyUserIdList);
Message dummyMessage = new Message("dummy", "", "", "dummy", "dummy", 1L);
ArrayList<Message> dummyMessages = new ArrayList<>();
dummyMessages.add(dummyMessage);
PairUp dummyPairUp = new PairUp("dummydummy", "dummy", "dummy", "dummy", dummyUserIdList);
HashMap<String, PairUp> dummyPairUps = new HashMap<>();
dummyPairUps.put("dummy", dummyPairUp);
String deviceToken = FirebaseInstanceId.getInstance().getToken();
String url = "";
Uri photoUrl = user.getPhotoUrl();
if (photoUrl != null)
url = photoUrl.toString();
finalCurrentUser = new User(user.getUid(), user.getDisplayName(), url, dummyUserEntries, dummyRequestSent, dummyRequestReceived, deviceToken, true, dummyPairUps);
}
use of com.google.firebase.auth.FirebaseUser in project ARD by MobileApplicationsClub.
the class AuthActivity method updateUserInfo.
/**
* Send relevant info of current user to firebase.
*
* @param firebaseAuth Firebase auth object to use.
* @param parentRef Reference to add/update child into.
* @return boolean true if result was updated successfully, false otherwise.
*/
public boolean updateUserInfo(@NonNull final FirebaseAuth firebaseAuth, @NonNull final DatabaseReference parentRef) {
final FirebaseUser firebaseUser = firebaseAuth.getCurrentUser();
if (firebaseUser == null) {
return false;
}
final String uid = firebaseUser.getUid();
final String name = firebaseUser.getDisplayName();
final String email = firebaseUser.getEmail();
final String photoUrl;
final Uri uri = firebaseUser.getPhotoUrl();
if (uri == null) {
photoUrl = "";
} else {
photoUrl = uri.toString();
}
final DatabaseReference userDb = parentRef.child(uid);
userDb.child(UserItemKeys.FDR_USERS_NAME).setValue(name);
userDb.child(UserItemKeys.FDR_USERS_EMAIL).setValue(email);
userDb.child(UserItemKeys.FDR_USERS_PHOTO_URL).setValue(photoUrl);
return true;
}
Aggregations