I have implemented categories using 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 postdata 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.