I don't receive notifications in background
See original GitHub issueI want to have scheduled notifications that would push even when the app is killed. This is Settings.js where the user can schedule the notification:
async function onCreateTriggerNotification() {
const date = new Date(Date.now());
date.setHours(11);
date.setMinutes(13);
const trigger: TimestampTrigger = {
type: TriggerType.TIMESTAMP,
timestamp: date.getTime(),
};
await notifee.createTriggerNotification(
{
id: '123',
title: 'Meeting with Jane',
body: 'Today at 11:20am',
android: {
channelId: 'your-channel-id',
pressAction: {
launchActivity: "default",
id: "default",
}
},
},
trigger,
);
}
index.js
notifee.onBackgroundEvent(async ({ type, detail }) => {
const { notification, pressAction } = detail;
if (type === EventType.ACTION_PRESS && pressAction.id === 'mark-as-read') {
console.log(notification)
// await notifee.cancelNotification(notification.id);
}
});
App.js
async function bootstrap() {
const initialNotification = await notifee.getInitialNotification();
if (initialNotification) {
console.log('Notification caused application to open', initialNotification.notification);
console.log('Press action used to open the app', initialNotification.pressAction);
}
}
useEffect(() => {
bootstrap()
}, []);
I can get a notification when the app is minimized but I don’t receive anything when the app is killed. I receive that notification only when I open the app again.
I’m new to this and a bit confused. Should I use something else like firebase messaging to be able to receive notifications even when the app is quit?
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Android Notifications Not Showing Up? 10 Fixes You Can Try
Not seeing notifications show up on your Android phone? Try these fixes to get Android notifications working again.
Read more >Why don't I receive notifications or sound alerts? - Email
Ensure that you have "Allow Notifications" enabled ; Go back to the home screen of your Settings app; Tap on "General"; Tap on...
Read more >What can I do if I'm not getting any notifications on Android?
Go to Phone Settings > Apps > Wire > Data usage and check whether your phone is restricting background data for Wire. 5....
Read more >Notifications Not Shown - Mobile Push
Common reasons why Mobile Push notifications are not showing on your device.
Read more >IOS 14.2 iPhone 10X notifications not pre… - Apple Community
It may be that those apps are not running in the background as they ... I still get notifications for non Outlook email,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@helenaford , it worked! Thank you so much! Thank you both for such a quick reply. You’re the best 😃
@xenia19 have you tried creating a trigger with the following props (docs):
@mikehardy I think we need to update the lib to default to using the alarm manager as I feel like it’ll be a lot easier, fewer steps to setup triggers.