Synchronization service (RemoteSyncService) - GhostBusters-APM/GhostHouse GitHub Wiki
Service to communicate with the backend and synchronize data with it. It fetches the user devices and the power data associated with it. The service is set up to automatically fetch the user devices every 15 minutes, but a synchronization can be scheduled by any part of the application at any time. This postpones the next scheduled update until another 15 minutes have passed.
Device power data is updated in a more tightly schedule, to allow to refresh the data when it is being shown more frequently. This implies a bigger data usage, so the updating is only triggered when power data view is shown, and stopped once is no longer active.
With Android 8.0 (Oreo - API 26) new limits are applied on background execution for applications. Most common usages of services can be substituted by the use of JobServices introduced in API 21 (Lollipop - 5.0). The synchronization service is implemented extending the support class JobIntentService that uses JobServices when available, falling back to regular Services on older platforms.