dispatchEvent details are not passed to background args
@theproducer is already working on this.
Since Jul 15, 2024.
Assessment
This issue has not been assessed yet.
Description
As the title describes dispatchEvent details are not passed to background args so i cannot use any component data in my background proces for fetching stuff for example
Let's say i have a function triggered by a button:
async activateBackgroundTask() {
try {
await BackgroundRunner.dispatchEvent({
label: 'com.app.app.check',
event: 'backgroundEventExecute',
details: { hello: "Hello world"},
})
} catch (error) {
console.error('Background task error:', error);
}
}
And a runner.js like this:
addEventListener('backgroundEventExecute', async (resolve, reject, args) => {
try {
// Notify that the background event was triggered
console.log('backgroundEventExecute: ', args, args.hello);
resolve();
} catch (error) {
console.error('Error in backgroundEvent:', error);
reject(error);
}
});
My args is always empty so the data i want to pass will never reach the background process. My console.log is reached and printed in the console. I've also tried to use CapacitorKV.get but i cannot use CapacitorKV.set in my angular/ionic component as it is not available there..
Specs:
"@capacitor/background-runner": "^1.1.0",
Angular: 17.x.x
Capacitor: 6.x.x
Can someone please tell me how to solve this issue OR fix this so we can use this background-runner?
Thanks in advance!
- Dominant language
- C
- Stars
- 56
- Forks
- 36
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 3
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ionic-team/capacitor-background-runner
-
[Bug]: android notification channel id not used in CapacitorNotifications.schedulePossibly taken @coffeemakr claimed this 18 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
ionic-team/capacitor-background-runner#158 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
ionic-team/capacitor-background-runner#155 · 1 reaction ·
-
Capacitor keeps running old background runnersMay be free again @theproducer claimed this 262 days ago, and no pull request is open. Openbug
ionic-team/capacitor-background-runner#152 · 1 comment · 2 reactions · 1 assignee ·
All issues in ionic-team/capacitor-background-runner
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
antoxa2584x/nfsu2-sw#44 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
codepointerapp/codepointer#231 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
kubernetes-sigs/security-profiles-operator#3597 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
ImageMagick/ImageMagick#9038 ·
Maintainers usually reply within 1 day