Avoid calling localNotificationReceived on iOS automatically

15 views
Skip to first unread message

Ivan

unread,
Jun 10, 2021, 5:06:35 PM6/10/21
to CodenameOne Discussions
Hi guys,

I'm using local notifications in my application. On android everything works well.
I have troubles with iOS. When the application is active and notification is scheduled and sent it's immediately received (localNotificationReceived is called). 

I tried to use LocalNotification.setForeground(true) and to trap the automatic call of localNotificationReceived. In this case the notification is displayed in notification area but clicking on it does not call  localNotificationReceived anymore (because it was received already, probably)

Is it possible to disable automatic call of localNotificationReceived() in iOS when application is active? 

thanks

Ivan

Shai Almog

unread,
Jun 10, 2021, 10:34:35 PM6/10/21
to CodenameOne Discussions
Hi,
if you kill the app and then click the notification will the localNotificationReceived be invoked?

Ivan

unread,
Jun 14, 2021, 3:48:32 PM6/14/21
to CodenameOne Discussions
Hi, 
yes, in that case it is invoked properly. 


Dátum: piatok 11. júna 2021, čas: 4:34:35 UTC+2, odosielateľ: Shai Almog

Shai Almog

unread,
Jun 14, 2021, 10:08:37 PM6/14/21
to CodenameOne Discussions
Hi,
That sounds like the correct behavior.
Looking at the code I don't see anywhere where we keep "state" of what was processed. I think this is just iOS that isn't sending the state if it was already sent. So I'm not sure if there's something we can do about it.
Reply all
Reply to author
Forward
0 new messages