Open soniabehal opened 6 years ago
If you could post the code you're using to schedule the notification, it will help. Otherwise it's not really possible for others to assist you.
Maybe it is the same mistake i made first: i forgot "foreground: true" and the notification was not displayed on iOS (on Android it worked without this option)
@jtheiss for foreground:true, it gives me this error Argument of type '{ id: number; text: any; title: any; foreground: boolean; }' is not assignable to parameter of type 'ILocalNotification | ILocalNotification[]'. Object literal may only specify known properties, and 'foreground' does not exist in type 'ILocalNotification | ILocalNotification[]'. (property) foreground: boolean
@Tawpie, The code i am using to schedule the local notification is as below
this.localNotifications.schedule({
id: ++this.id,
text: data.extra_information,
title: data.title
});
and the above code is written under
this.fcm.onNotification().subscribe(data => {}) // FCM Block
There is one another issue, the local notification calls this FCM block rather then displaying to user
if i use the plugin like the documentation recommends it works just fine
cordova.plugins.notification.local.schedule({ title: 'My first notification', text: 'Thats pretty easy...', foreground: true });
if i use only text & title the notification is only shown on android
cordova.plugins.notification.local.schedule({ title: 'My first notification', text: 'Thats pretty easy...' });
i made the mistake during updating to 0.9 from an older version. but maybe you have a different problem... sorry i couldn't help
@soniabehal I would recommend including an 'at' property so the notification is provided with a time to appear. This time-to-appear should be a few seconds in the future. iOS in particular will not present a notification that was supposed to appear in the past. Some (most?) versions of Android will post stale notifications but I'd rather schedule them in the future so I don't have to worry about them being suppressed by the operating system.
I think that for iOS local Notifications plugin catches the FCM Notifications when the app is in foreground.
@Tawpie for the "at" property, i am getting the error Argument of type '{ id: number; text: string; title: string; priority: number; at: any; }' is not assignable to parameter of type 'ILocalNotification | ILocalNotification[]'. Object literal may only specify known properties, and 'at' does not exist in type 'ILocalNotification | ILocalNotification[]'. (property) at: any
On Tue, Aug 21, 2018 at 7:32 PM Tawpie notifications@github.com wrote:
@soniabehal https://github.com/soniabehal I would recommend including an 'at' property so the notification is provided with a time to appear. This time-to-appear should be a few seconds in the future. iOS in particular will not present a notification that was supposed to appear in the past. Some (most?) versions of Android will post stale notifications but I'd rather schedule them in the future so I don't have to worry about them being suppressed by the operating system.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/katzer/cordova-plugin-local-notifications/issues/1662#issuecomment-414684864, or mute the thread https://github.com/notifications/unsubscribe-auth/AQLCqrWzXxPXbpG6SQy8ZxvAojY-lCQVks5uTBMOgaJpZM4V_l6A .
@MiguelSyll i am getting the opposite result. For my application, its FCM Notifications that catches the iOS local Notifications
On Wed, Aug 29, 2018 at 3:21 PM MiguelSyll notifications@github.com wrote:
I think that for iOS local Notifications plugin catches the FCM Notifications when the app is in foreground.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/katzer/cordova-plugin-local-notifications/issues/1662#issuecomment-416894793, or mute the thread https://github.com/notifications/unsubscribe-auth/AQLCqqrVzUS1qkXQuZNLy8-TM_yMbAkyks5uVmQ1gaJpZM4V_l6A .
@Tawpie for the simple local notification with FCM notification scope, the logs say that application has received the push notification. My code there is this.localNotifications.schedule({ id: 1, text: "Hello ios", title: "i am here", priority: 1 });
and logs are:- [Log] Received push notification (cordova.js, line 1731) [Log] {smallIcon: "res://icon", title: "i am here", defaults: 0, vibrate: false, progressBar: {enabled: false, value: 0}, …} (cordova.js, line 1731)
But the notification is not formed.
On Fri, Aug 31, 2018 at 10:16 AM sonia behal soniabehal19@gmail.com wrote:
@MiguelSyll i am getting the opposite result. For my application, its FCM Notifications that catches the iOS local Notifications
On Wed, Aug 29, 2018 at 3:21 PM MiguelSyll notifications@github.com wrote:
I think that for iOS local Notifications plugin catches the FCM Notifications when the app is in foreground.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/katzer/cordova-plugin-local-notifications/issues/1662#issuecomment-416894793, or mute the thread https://github.com/notifications/unsubscribe-auth/AQLCqqrVzUS1qkXQuZNLy8-TM_yMbAkyks5uVmQ1gaJpZM4V_l6A .
It happens to me exactly the same when I receive a notification from FCM and I'm in the foreground the method catches
vm.fcm.onNotification().subscribe(data => {
if(data.wasTapped){
console.log("Received in background");
} else {
console.log("Received in foreground");
console.log("Received in foreground",JSON.stringify(data))
vm.localNotifications.schedule({
id: 1,
text: 'Single ILocalNotification 1',
sound: "default",
foreground: true,
data: { secret: 1 }
});
};
});
That is when we call the local notification, but there is no sample, in addition to the local notification, we call the complete function of FCM and create an infinite loop, when we leave the application, we ask them to respond.
Local notification is not formed in ios 11 with 0.8.5 and 0.9.0-beta.3 versions . Application is able to receive the FCM(Firebase cloud messaging) notification data and when the application tries to create local notification ,its not formed even in the FCM trigger block as well as outside its scope.
Environment
cordova -v
): 8.0.0cordova platform ls
): 8.0.0Expected Behavior
Its expected that whenever the application tries to schedule the local notification ,it should appear on user's screen.
Actual Behavior
Local notification is never formed.
Steps to Reproduce
Reproduce this issue; include code to reproduce, if relevant
Context
Was trying to use the firebase cloud messaging service in ios and fcm is working fine but whenever the application tried to show user a notification ,its unable to do the same.