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

fix(android): registering WorkRequest on handleOnPause #79

Merged
merged 3 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tricky-stingrays-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@capacitor/background-runner": minor
---

(Android): Fixing issue that disabled `appStateChange` events
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,15 @@ class BackgroundRunnerPlugin: Plugin() {
const val NOTIFICATIONS = "notifications"
}

override fun handleOnPause() {
super.handleOnPause()
Log.d("Background Runner", "registering runner workers")
impl?.scheduleBackgroundTask(this.context)
}

override fun load() {
super.load()
impl = BackgroundRunner.getInstance(this.context)

bridge.app.setStatusChangeListener {
if (!it) {
Log.d("Background Runner", "registering runner workers")
impl?.scheduleBackgroundTask(this.context)
}
}
}

@PluginMethod
Expand Down
2 changes: 1 addition & 1 deletion packages/capacitor-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"docgen-api": "docgen --api CapacitorAPI --output-readme API.md --output-json dist/docs-api.json && node ./scripts/combine_docs.js",
"build-sdk": "./scripts/build-native-sdks.sh",
"build": "npm run clean && npm run docgen && npm run docgen-api && tsc && rollup -c rollup.config.js && npm run build-sdk && ./scripts/copy-native-sdks.sh && npm pack && mv ./capacitor-background-runner-*.tgz ../../ && ./scripts/copy-readme.sh",
"pack": "npm run build && && ./scripts/copy-native-sdks.sh && npm pack && mv ./capacitor-background-runner-*.tgz ../../",
"pack": "npm run build && ./scripts/copy-native-sdks.sh && npm pack && mv ./capacitor-background-runner-*.tgz ../../",
"clean": "rimraf ./dist",
"watch": "tsc --watch",
"prepublishOnly": "npm run build",
Expand Down
Loading