Search code examples
androiddelphidelphi-xe7notificationcenter

Using TNotificationCenter.OnReceiveLocalNotification


I'm trying to catch the message in NotificationCenter in order to use it for other purposed, when i receive a notification into my device thru gcm php server i tried to catch the message with NotificationCenter:NotificationCenterReceiveLocalNotification Event but unfortunartly it did NOT.

procedure Tdm.NotificationCenterReceiveLocalNotification(Sender: TObject;   ANotification: TNotification);  
begin   
           ShowMessage(ANotification.Name) ;   
end;

Any idea what will be the error or the mistake ?

Thank you.


Solution

  • You are trying to get a remote notification (PUSH - GCM) with NotificationCenter that handles local notifications.

    To handle push you have to use TPushEvents component, OnPushReceived event, being more specific.