I’ve loading native UDI
and Token
which are saved by Ionic Native Storage
correctly in Loginpage
after SMS
verification.
But the problem is on mobile device the NativeStorage.getItem
return result after moving to login page and then moving to DashboardPage after a minuet.
How can I solve this and how to speedup this process? Also this data should be stored safely for use in next app updates.(avoiding each time app updates usere register or login again and again.)
app.componnent.ts
export class Myapp {
@ViewChild(Nav) nav: Nav;
rootPage: any = FirstPage;
constructor(private NativeStorage: NativeStorage, private platform: Platform) {
this.initializeApp();
}
initializeApp() {
console.log('appcomponent');
this.platform.ready().then(() => {
console.log('ready');
NativeStorage.getItem('UserDeviceauth')
.then(
data => {
console.log(data);
console.log(data.UDI, data.Token);
if ( data.UDI == 'undefined' || data.Token == 'undefined') {
this.nav.setRoot(LoginPage)
}
else {
this.nav.setRoot(DashboardPage, data);
}
});
});
}
openPage(page) {
this.nav.setRoot(page.component);
}
}