2

I want to check, if a boolean is true, on every app start. So when the boolean is false, the user should be redirected to a certain activity. I do this call in my start activity. But when the user enters the app via notification or direct activity start, this is not called.

I tried to do that in my Applications class, but since I can't redirect users to activities there, this does not work and I don't want to add this call to every activity.

How can I check, if a user is logged in no matter, which activity is started?

Zoker
  • 2,020
  • 5
  • 32
  • 53

1 Answers1

2

Create a BaseActivity and extend all your activities with this base activity. Then put your boolean checking code in that base activity. No matter from which activity your app starts if all your activities and extending this base activity it will get called. It will look something like this:

public class BaseActivity extends Activity{

    @Override
    public void onResume() {
        super.onResume();
        // check your boolean here and act accordingly

    }

}

Then extend all your activities with this one.

Talha Mir
  • 1,228
  • 11
  • 19