Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70435

Why when i close android app, the nativeStorage on ionic not save my data

$
0
0

@andika1204 wrote:

I have a problem, when I login to the application. Native storage on Ionic keeps the login result data well but when I close my application, the data on nativestorage is gone and also I’m not trigger this.nativeStorage.remove() command. Anyone know what cause this? And how to solve it? i’m using ionic 3

This is the login data when I logged in

   {
    "phonenumber":"12341234",
    "username" : "bingo"
    }

but when I close the application

{
    "phonenumber":"",
    "username":""
    }

the declaration variable

 login : any ={
   phonenumber : '',
   username : '',
  }

the set function

 SetLogin(_login : any)
  {
    this.login.phonenumber = _login.phonenumber;
    this.login.username = _login.username;
    this.nativeStorage.setItem('Loginmodel',this.login );

  }

the get function

 GetLogin()
  {

    this.nativeStorage.getItem('Loginmodel') .then(
      data => {
        console.log(data);
        this.login = data;
      },
      error => console.error(error)
    );
    return this.login;
  }

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 70435

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>