I want to remain user in login state even after the app is uninstalled. I use phone Auth for Firebase. From Stack overflow I found and tasted the following code for checking if user exist or not :
FirebaseAuth.AuthStateListener authStateListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser firebaseUser = firebaseAuth.getCurrentUser();
if (firebaseUser != null) {
Intent intent = new Intent(PhoneAuthActivity.this, MainActivityDriverLogin.class);
startActivity(intent);
finish();
}else {
Toast.makeText(PhoneAuthActivity.this, "Please Write Your Phone Number", Toast.LENGTH_SHORT).show();
}
}
};
and I set onStart :
mAuth.addAuthStateListener(authStateListener);
but, no luck, When I install app again, I have to use phone Number again.
I also tried in Manifests :
android:allowBackup="true"
android:fullBackupContent="true"
But, though the login has lost.
Is there any way for one time login in app, and remain login even the app unistalled or even clear cache from system ?
I think you are looking for smart lock feature in android.Google smartlock. You need to enable the feature on your authenitication. I assume you are using Firbase Authenitaction Ui using this method .setIsSmartLockEnabled(true)