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

Scheduled Notifications not appearing on android #77

Closed
RaafatAburashed1 opened this issue Mar 19, 2024 · 0 comments
Closed

Scheduled Notifications not appearing on android #77

RaafatAburashed1 opened this issue Mar 19, 2024 · 0 comments

Comments

@RaafatAburashed1
Copy link

I am trying to schedule a local notification on android using a background runner from the docs. However nothing appears in the status bar after the allotted time. The background runner is working as i tested it for setting KV and retrieving it.

within background.js

addEventListener("notiTestEvent", async (resolve, reject, args) => {
    try {
        let scheduleDate = new Date();
        scheduleDate.setSeconds(scheduleDate.getSeconds() + 5);
        CapacitorNotifications.schedule([
            {
                id: 312,
                title: "Enterprise Background Runner",
                body: "A test message from the Enterprise Background Runner",
                scheduleAt: scheduleDate,
            },
        ]);

        resolve();
    } catch (err) {
        console.log("err", err);
        reject(err);
    }
});

function calling event

  const ontestbasic = async () => {
    try {
      await BackgroundRunner.dispatchEvent({
        label: 'com.reacttest.app.task',
        event: 'notiTestEvent',
        details: {}
      });
      setValue('notification scheduled');
    } catch (err) {
      console.log('err', err);
    }
  };

Heres the repo if it helps
https://github.com/RaafatAburashed1/test-react-noti

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

No branches or pull requests

1 participant