diff --git a/config.xml b/config.xml index f35f79a3a..33e6375ec 100644 --- a/config.xml +++ b/config.xml @@ -122,7 +122,7 @@ - + diff --git a/src/providers/local-notifications.ts b/src/providers/local-notifications.ts index 4002a066d..29ea131a2 100644 --- a/src/providers/local-notifications.ts +++ b/src/providers/local-notifications.ts @@ -125,17 +125,19 @@ export class CoreLocalNotificationsProvider { this.appDB = appProvider.getDB(); this.appDB.createTablesFromSchema(this.tablesSchema); - localNotifications.on('trigger', (notification, state) => { - this.trigger(notification); - }); + platform.ready().then(() => { + localNotifications.on('trigger', (notification, state) => { + this.trigger(notification); + }); - localNotifications.on('click', (notification, state) => { - if (notification && notification.data) { - this.logger.debug('Notification clicked: ', notification.data); + localNotifications.on('click', (notification, state) => { + if (notification && notification.data) { + this.logger.debug('Notification clicked: ', notification.data); - const data = textUtils.parseJSON(notification.data); - this.notifyClick(data); - } + const data = textUtils.parseJSON(notification.data); + this.notifyClick(data); + } + }); }); eventsProvider.on(CoreEventsProvider.SITE_DELETED, (site) => {