How to restart app and clear all data with Button

185 views Asked by At

If you go to the programme information on the phone, you will see delete all data. The question is how to do it in Java in MainActivity and reboot it. Is it even possible to do that?

I need this to sign out. In my project (MainActivity), there is a login via Google and email & password. When I call the signOut () function, I don't log out of my accounts. And to make life easier, I decided to clean and restart.

Button btnClearAndRestart = findViewById(R.id.btn);
btnClearAndRestart.setOnClickListener(new View.OnClickListener(){
    //Delete all app data and restart app
});
0

There are 0 answers