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

notifee.onBackgroundEvent only calls second time on iOS #1130

Open
anoopmm opened this issue Oct 21, 2024 · 0 comments
Open

notifee.onBackgroundEvent only calls second time on iOS #1130

anoopmm opened this issue Oct 21, 2024 · 0 comments

Comments

@anoopmm
Copy link

anoopmm commented Oct 21, 2024

I have implemented categories using Notifee.setNotificationCategories

await notifee.setNotificationCategories([
    {
      id: 'actions',
      actions: [
        {
          id: 'yes',
          title: 'Yes',
        },
        {
          id: 'no',
          title: 'No',
        },
        {
          id: 'reply', // Action with input
          title: 'Reply',
          input: {
            placeholder: 'Type your reply here...', // Placeholder text for input field
            buttonText: 'Send', // Text for the action button
          },
        },
      ],
    },
  ]);

I need to call an API once the user types something in text box and clicks on reply

notifee.onBackgroundEvent(({type, detail}) => {
if (detail.pressAction.id === 'reply') {
  const userInput = detail.input; // This is the input text entered by the user
  console.log('User input:', userInput);
  postData(userInput, detail.notification.data.conversation_id);//api call
}
});

in the above function post data should call an API with user input

It only works the second time if the app is in a quit state. How can I make it work on the first notification?
I think the app is possibly being woken up by the first notification in the background, and it works on the second notification because the app was already woken up by the first one.

@anoopmm anoopmm changed the title notifee.onBackgroundEvent only calls second time notifee.onBackgroundEvent only calls second time on iOS Oct 21, 2024
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