Peter-John Jansen
Peter-John Jansen

Reputation: 643

Delphi/Firemonkey ios know when Local Notification is presented when App in Foreground

TNotificationCenter has a event called OnReceiveLocalNotification

but the code in that event is only called if your App was in the background and you recieved the notification and responded to the notification.

According to the iOS Documentation on the Objective side of things application:didReceiveLocalNotification: is called when a local notification is recieved and your App is in the forground, and the method is implemented in FMX.Platform.iOS but I am not sure to what TMessage I should be subscribed to to know when it is triggered

Subid := mesman.SubscribeToMessage(System.Messaging.TMessage<TNotification>,procedure(const Sender: TObject; const M: TMessage)
begin
    showmessage('Test');
end);

If I subscribe to :

System.Messaging.TMessage<TNotification> 

It has the same behaviour as the OnReceiveLocalNotification

If I Subscribe to :

System.Messaging.TMessage<UILocalNotification>

It never gets triggred

Thanks guys!

Upvotes: 0

Views: 404

Answers (1)

Peter-John Jansen
Peter-John Jansen

Reputation: 643

In FMX.Platform.iOS applicationDidReceiveLocalNotification always gets called in response to a local Notification, even if your App is in the foreground.

Upvotes: 1

Related Questions