Skip to content

[MS-368] Opting out of setting worker service foreground when battery optimization on#700

Merged
alex-vt merged 4 commits into
release/2024.1.0from
bugfix/MS-368-foreground-crash
Apr 24, 2024
Merged

[MS-368] Opting out of setting worker service foreground when battery optimization on#700
alex-vt merged 4 commits into
release/2024.1.0from
bugfix/MS-368-foreground-crash

Conversation

@alex-vt
Copy link
Copy Markdown
Contributor

@alex-vt alex-vt commented Apr 24, 2024

A fix for some cases of uncaught BackgroundServiceStartNotAllowedException, before an improved solution is found.

fun isFollowingBatteryOptimizations(context: Context): Boolean =
(context.getSystemService(Context.POWER_SERVICE) as PowerManager)
.isIgnoringBatteryOptimizations(context.packageName)
.not()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This reminds me of very old Borat sketch :D

@sonarqubecloud
Copy link
Copy Markdown

@alex-vt alex-vt merged commit e8b6e0c into release/2024.1.0 Apr 24, 2024
@alex-vt alex-vt deleted the bugfix/MS-368-foreground-crash branch April 24, 2024 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants