javaandroidfirebasejob-schedulingfirebase-job-dispatcher

Firebase Jobdispatcher - to use or not to use


I am developing an App, a simple, but hopefully addictive little game. The user has to solve predefined levels, as quick as possible.

Information on the levels is stored online in an MySQL database, which also contains the average time it took all players to complete a given level. Also, the level-data is stored, locally, in a SQlite database on the phone.

What I want to do is the following. I want to synchronize the average time (from server to phone) and upload the time it took a player to complete a leve (from phone to server).

Ideally this happens each time the player starts the app or finishes a level. For this, I am considering a Firebase Jobdispatcher, but I was wondering if this is overkill or not. For your information: it is not the end of the world if the average time stored on the phone is not entirely up to date. The game will work just fine without it being up to date. On the other hand, I want it to get updated regularly as the performance of the user will be compared to the average time.

I am a beginner, who wants to do things correctly. Hope you can help.


Solution

  • It sounds like you already know when some work should happen. As you said:

    Ideally this happens each time the player starts the app or finishes a level.

    You don't need JobDispatcher to schedule work when you are already in control of the times when the work should happen. JobDispatcher is used when you need to schedule some work at some point in time or interval when your app may not even be running.