Pregunta

I have researched and I found a lot of sollutions how to logout. The big problem is when I´m in background... if I use the setFlags it brings my sollution to the top and if I was doing something else in my device it will come back to foreground.

That´s my sollution and it work fine, but how I do this in background?

Intent i = new Intent(getApplicationContext(), LoginActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
¿Fue útil?

Solución

Well I find a way to do that using one sollution that I find here on stack. I create a broadcast message and when I open the activity I check if the logout message is broadcaster and I finish the activity.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top