End background task after receiving location #1049
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
One Line Summary
OneSignal was kicking off a background task for requesting the location when the app entered the background, however we were not ending the background task after sending the location which caused an error log.
Fixes #1047
Details
When the app enters the background we kickoff a significant change location listener that does not require a background task to be active. If the significant change service is not available then we just ask for the current location and will not continue updating in the background. After we either kick off the significant change listener or receive the current location we need to end the background task.
Testing
Manual testing
I have successfully tested background location updating using the simulators mock location functionality. The error no longer appears and locations still are updated in the background.
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is