I am developing an application in ionic 7 with angular 17.0.2 with Cordova Plugins.
My application provides notification by following a process. I am displaying the countdown for the next notification once the process starts. The issue I am facing here is when I open the application after few hours of inactivity of the application the component showing the countdown is set to 0h 0d 0m instead of showing actual time left. When this issue occurs if I remove the application from the background and on opening the app again the timer shows proper timings.
Below is the constructor block of my ionic page where I have the countdown and the Bindclassvar() is to change the image based on the value from ionic storage.
constructor(public plt: Platform, public navCtrl: NavController, public CommonProvider: ConvertProvider, public OfflineDb: OfflinedbProvider,
public LocalStorage: Storage, private loadingCtrl: LoadingController,
public localnotification: LocalNotifications, private dateTimeProvider: PdatetimeProvider) {
this.count = 0;
this.DeadlineTime = this.dateTimeProvider.getCurretntDateTimeinMillisecs();
this.nowDateTime = this.dateTimeProvider.getCurretntDateTimeinMillisecs();
this.Days = "0";
this.Hours = "0";
this.Mins = "0";
Promise.resolve([])
.then(x => this.Bindclassvar())
.catch(err => { throw new Error('Error -' + err); })
}
Bindclassvar() {
return new Promise((resolve, reject) => {
this.LocalStorage.get(‘GuideType’).then(data => {
if (data) {
if (data == ‘Collin’) {
this.classVariable = ‘collin-nexttask’;
}
else {
this.classVariable = ‘colleen-nexttask’;
}
resolve(1);
}
else {
resolve(1);
}
}).catch(e => console.log(JSON.stringify(e)));
});
}
2 posts - 2 participants