Data Finder
Data Finder

Reputation: 33

how to implement background timer for multiple online order android app

I am developing android application on which peoples donate food etc and when they submit their donations i want to start timer about 30 to 50 minutes in background even they close the application. Timer continuously run in background and if any user open the app it shows the remaining time also according to background progress.

I want to use background service which count time but if any user submitted multiple orders then how it works and also I want to change time duration through firebase. Background time is running and if we decide to increase time then we increase it through firebase and changes also takes place in app background service.

What are they ways I used to implement this kind functionality.

Upvotes: 0

Views: 70

Answers (1)

Bruno
Bruno

Reputation: 4007

Do you want any notification from background ? If not, you don't need a background service just to display remaining time.

All you have to do is :

  • save the time of the last donation in SharedPreferences for example or in Database
  • every time the app is opened
    • check the duration with Firebase
    • launch a CountDown timer to display remaining time

I think it will do the job.

Upvotes: 1

Related Questions