After login with facebook it's not go to rootpage

i just did log in with facebook in my ionic 2 app,it works fine but
when i log in in first time it goes to the home page but when i exit from the app and run again

ionic run android

it not go to home page but it shows like the user is connected.
i connected my phone and i saw in chrome://inspect that it’s print the user details but it shows me blank page
in my app.component.ts
i did this

import { Component } from ‘@angular/core’;
import { Platform } from ‘ionic-angular’;
import { StatusBar, Splashscreen } from ‘ionic-native’;

//import pages
import { HomePage } from ‘…/pages/home/home’;
import { LoginPage } from ‘…/pages/loginPage/login-page’;

//import plugins
import firebase from ‘firebase’;

template: <ion-nav [root]="rootPage"></ion-nav>
export class MyApp {

constructor(platform: Platform) {
apiKey: “AIzaSyDOpRshkjuy_tGXSzw34RFHXmAFelyAUt0”,
authDomain: “”,
databaseURL: “”,
storageBucket: “”,
messagingSenderId: “704224601349”

 firebase.auth().onAuthStateChanged((user) => {
  if (user) {
    this.rootPage = HomePage;
    console.log("I'm here! HomePage");
  } else {
    this.rootPage = LoginPage;
    console.log("I'm here! LoginPage");
platform.ready().then(() => {
  // Okay, so the platform is ready and our plugins are available.
  // Here you can do any higher level native things you might need.


in login-page.ts
i did this function

Facebook.login([‘email’]).then( (response) => {
let facebookCredential = firebase.auth.FacebookAuthProvider.credential(response.authResponse.accessToken);
var that = this;
.then((success) => {
console.log("Firebase success: " + JSON.stringify(success));
that.userProfile = success;
that.nav.setRoot(HomePage); // after login in it goes to homepage

      .catch((error) => {
        console.log("Firebase failure: " + JSON.stringify(error));
}).catch((error) => { console.log(error) });
let loader = this.loadingCtrl.create({
  dismissOnPageChange: true,

in my first time when i login it shows all the details fine

but when i exit from emulator\chrome://inspect and run the app again it shows me blank page

1 Like