transistorsoft / capacitor-background-fetch

Periodic callbacks in the background for both IOS and Android
78 stars 9 forks source link

[Question] What API does the plugin use under Android? #1

Closed SerQuicky closed 3 years ago

SerQuicky commented 3 years ago

Hello @christocracy,

first of all, I want to thank you for this great plugin. I just have a general question on how the plugin creates the background tasks under android. I do understand, that it uses the Background Tasks API under iOS. Does it use the WorkManager API under Android or another API?

christocracy commented 3 years ago

What background-tasks are you referring? The one from startBackgroundTask?

SerQuicky commented 3 years ago

If I use your Angular-Example and schedule the task with initBackgroundFetch it works completely fine, but I don't really understand what Android-API it uses under the hood (Services, WorkManager, etc.).

christocracy commented 3 years ago

Sorry, I thought we were at the background-geolocation repo. I see this is background-fetch.

This plugin uses JobScheduler for sdk >= lollipop and AlarmManager for everything less.

This is essentially what WorkManager is. WorkManager is merely a wrapper for JobScheduler + AlarmManager.