【发布时间】:2015-05-10 19:47:18
【问题描述】:
我正在使用 Delphi XE7。 我有一个 android 移动应用程序,接收推送通知。 有时,我在顶栏上有十个或更多推送图标通知。 当用户仅单击一个通知图标时,我希望所有通知都显示在我的应用程序中。
我执行了下一个过程来捕获所有它们,但没有工作,因为它只捕获单击的推送消息。
有人可以帮我解决这个问题吗?
var NotificationCenter: TNotificationCenter;
PushEvents1:TPushEvents
//this procedure is called in the OnActivate event of app the main form.
procedure getAllNotfications;
begin
AServiceConnection:=PushEvents1.PushConnection;
if AServiceConnection = nil then exit;
LNotifications:=AServiceConnection.Service.StartupNotifications;
K:=Length(LNotifications);
for i:= low(LNotifications) to high(LNotifications) do begin
LNotification := TPushData.Create;
LNotification.Load(LNotifications[i].Json);
try
if (Assigned(LNotification) and ((LNotification.GCM.Message<>'') or (LNotification.Message<>''))) then begin
Memo1.Lines.Add('Enter by Notification Click: ' + LNotification.GCM.Message);
end;
finally
LNotification.DisposeOf;
LNotification:=nil;
end;
end;
end;
问候,路易斯
【问题讨论】:
-
谢谢,但我认为折叠键不是解决方案。如果我理解的话,折叠键 gcm 消息只能从许多具有相同折叠键的消息中传递一条消息。我需要将所有消息捕获到我的应用程序,而不仅仅是最后发送的消息。
-
@LuizAlves 你成功了吗?如果你解决了,能否给我们一个更新?
标签: android delphi mobile push-notification google-cloud-messaging