redirect user if the already logged in ionic

I want to redirect logged in user if the comeback to my app the will redirected to home not to log in page.

in my login function like this

login(){
    this.googlePlus.login({
      'webClientId' : '927898787134-spvfdmvm9apq0e1fo2efvvura8vqpid8.apps.googleusercontent.com',
      'offile' : true
    }).then(res=>{
      firebase.auth().signInWithCredential(firebase.auth.GoogleAuthProvider.credential(res.idToken))
      .then(suc=>{
        // console.log('users', JSON.stringify(suc));
        localStorage.setItem('user', JSON.stringify(suc));
        this.router.navigate(["/tabs/home"]);
      }).catch(ns=>{
        alert('Unsucessful');
      })
    })
  }

i have user data in my localStorage, i think i can check whether the user token is exist on localStorage or not. but when i try this in my login page

ionViewWillEnter() {
    firebase.auth().onAuthStateChanged(function(user) {
      if (!user) {
        console.log("user is not logged in");
      } else {
        console.log("user is logged in");
        this.router.navigateByUrl('/tabs/home');
        return;
      }    
    });
  }

it doesn’t redirected to home, did anyone know exactly how to do that?

after trying to insert to app.component.ts my code like this

initializeApp() {
    this.platform.ready().then(() => {
      this.statusBar.overlaysWebView(true);
      this.statusBar.show();
      firebase.auth().onAuthStateChanged(function(user) {
        if (!user) {
          console.log("user is not logged in");
        } else {
          console.log("user is logged in");
          this.router.navigateByUrl('/home');
          return;
        }
      });
    });
  }

above code give me this error

error

heres my app-routing.module

const routes: Routes = [
  {
    path: '',
    loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule)
  },
  { path: 'login', loadChildren: './login/login.module#LoginPageModule' },
  { path: 'welcome', loadChildren: './welcome/welcome.module#WelcomePageModule' },
  { path: 'settings', loadChildren: './settings/settings.module#SettingsPageModule' }
];
@NgModule({
  imports: [
    RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
  ],
  exports: [RouterModule]
})
export class AppRoutingModule {}

Source: New feed
Source Url redirect user if the already logged in ionic