Ionic Autologin not working in android Nougout Ionic dev app


#1

I am creating an ionic application. I completed login and registration. I use JWT and on the login page, it will check for authentication and if the token doesn’t exist or different token from the server it will not get logged. This works perfectly when run on Ionic dev app in lollypop devices and ios. But in Nougut version, these methods are not working.

In Login.ts:

ionViewDidLoad() {
    console.log('ionViewDidLoad LoginPage');
    this.showLoader();
           //Check if already authenticated
           this.authService.checkAuthentication().then((res) => {
               console.log("Already authorized");
               this.loading.dismiss();
               this.navCtrl.setRoot(HomePage);
           }, (err) => {
               console.log("Not already authorized");
               this.loading.dismiss();
           });
  }


showLoader(){
    
           this.loading = this.loadingCtrl.create({
               content: 'Authenticating...'
           });
    
           this.loading.present();
    
       }

In Auth Provider:

checkAuthentication(){
    
       return new Promise((resolve, reject) => {
    
           //Load token if exists
           this.storage.get('token').then((value) => {
    
               this.token = value;
               console.log(this.token);
               let headers = new Headers();
               headers.append('Authorization', 'Bearer '+this.token);
    
               this.http.get('http://139.59.35.176/api/users/1', {headers: headers})
                   .subscribe(res => {
                       resolve(res);
                   }, (err) => {
                       reject(err);
                   });
    
           });        
    
       });
    
     }

I don’t know how to get the console when running on ionic dev app. also here loading screen

Authenticating…

is not dismissing in nougat android phones. What am I missing here?