Background
We have a background IntentService that runs whether the associated app is open or closed. (the onStartCommand
returns Service.START_STICKY
). API Guard is being used to authenticate any API calls being made.
Problem
API calls being made from the app and the background service work fine if the app is open. However, when the app is closed, calls made from the background service fail the API Guard authentication. Reason is that there's no Activity in the background which the API Guard SDK requires.
It seems strange that the SDK would require an Activity since a background service will likely have no UI.
What I've Tried
- Added
APIGuard.getInstance().reauthenticate();
inside theonCreate()
method of the background service class. This did not work. - Added an Activity to the background service implementation, but this not an option since the activity hijacks the focus from the service, which we can't have.
Question
Has anyone worked with something this specific on Android before? Again, I have to think API Guard has a way to handle this scenario.