Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

160
Views
Ionic 2 / Angular 2 Timer

I am using an Observable timer right now to open a modal for the first 15th minute and then every 24 hours.

 presentUpgradeModel() {
    let timer = Observable.timer(900000, 86400000);
    timer.subscribe(t => {
      if (this.shouldShowUpgradeModal) {
        this.openUpgradeModel();
      }
    });

  }

I am just wondering if this is consuming too many resources in the background or if there is a better way to do this? Its a mobile app so don't want to consume a lot of background processes.

Basically I just want a modal to popup every 24 hours or so.

Would setTimeout be better for this?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Well its not only about timers its also about background app on mobiles. First of all if user close an app it will be suspended and it will not work.

If you want to have messages like that look to Push notifications.

Sure you can use plugins to prevent background sleep but then your app will be using battery.

So to sum up better use Push notifications for notify users or you can use plugin but then no matter what your app will be using batter all the time

And lastly I would use observable for timer related things

PS. I forgot about native plugin called Local Notifications. It allow you to schedule and even if app is closed it will still trigger a process. this could a way to go

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!