Ionic 4 - bug trying to skip login page if user is logged in

I am basically trying to implement a logic that when the user is logged in, they should be taken immediately to the home page and skip the login page. Right now my code works, but there’s a delay, because the value of my BehaviorSubject is initialized as false and when I subscribe to it in my app.component.ts the initialization value of my BehaviorSubject is always false, then it changes to the last emitted value, which I change to true when the user logs in.

My problem is that due to the small delay, the login page first appears on the screen then it quickly changes to the home page.

Look at this screenshot:

TL;DR What can I do so when I subscribe to my BehaviorSubject I always get the last emitted value, ignoring its initial value?

Below some code for more info:


authenticationState = new BehaviorSubject(false);

constructor (...) {
    //Check if token is stored when the device is ready
    this.plt.ready().then(readySource => {

  checkToken() {
    return => {
      if (res) {;

login() {
    return, "user123").then(() => {;


constructor(...) { this.initializeApp() }

initializeApp() {
        "auth state current value is: " +
      this.authService.authenticationState.subscribe(state => {
        console.log("Auth state: " + state);
        if (state) {
        } else {

Did you solved this problem? I am facing the same behavior and want to change it.