bug: LocalNotifications don't popup.
Bug Report
Capacitor Version
Installed Dependencies:
@capacitor/ios not installed
@capacitor/cli 1.3.0
@capacitor/android 1.3.0
@capacitor/core 1.3.0
Affected Platform(s)
- [x] Android
- [ ] iOS
- [ ] Electron
- [ ] Web
Current Behaviour
When I schedule a local notification, the notification doesn't not appear as a toast type popup on the android emulator. Instead an (i) icon appears in the status bar and the notification can be viewed only if you open the Notifications Panel. Additionally, the localNotificationReceived event listener doesn't get called.
Expected Behaviour
I expect to see a Notification Popup at the scheduled time.
Sample Code or Sample Application Repo
import React, { PureComponent } from 'react';
import { Plugins } from '@capacitor/core';
class Notifications extends PureComponent {
componentDidMount = () => {
Plugins.LocalNotifications
.addListener("localNotificationReceived", (notification) => {
console.log('Notification =>', notification);
});
}
schedule = () => {
Plugins.LocalNotifications.schedule({
notifications: [{
title: "Title",
body: "Body",
id: 1,
schedule: { at: new Date(Date.now() + 1000 * 5) },
sound: 'res://platform_default',
badge: 1,
attachments: null,
actionTypeId: "",
extra: null
}],
});
}
render() {
return (
<div>
<button onClick={this.schedule}>
Schedule Notification in 5 Seconds
</button>
</div>
);
}
}
export default Notifications;
Reproduction Steps
Once app is up running on android emulator,
Attempt to schedule a notification using the LocalNotifications.schedule
Other Technical Details
This demo repo was spun up using create-react-app and capacitor
npm --version output: 6.1.0
node --version output: v8.11.3
pod --version output (iOS issues only):
I have this same question.
Capacitor LocalNotifications are shown in the status bar, not as toast, for toast messages you have toast plugin
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.