Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

End background task after receiving location #1049

Merged
merged 1 commit into from
Feb 15, 2022
Merged

Conversation

emawby
Copy link
Contributor

@emawby emawby commented Feb 14, 2022

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

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes
  • Distribution
  • Location

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

This change is Reviewable

The background task does not need to be running for the significant location change monitoring that allows background location tracking.
@emawby emawby requested review from jkasten2, nan-li and a team February 14, 2022 22:32
Copy link
Member

@jkasten2 jkasten2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @nan-li)

@emawby emawby merged commit 2875c38 into main Feb 15, 2022
@emawby emawby deleted the fix/end_location_bg_task branch February 15, 2022 22:17
@emawby emawby mentioned this pull request Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Background Task was created over 30 seconds ago
3 participants