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);
有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top