【发布时间】:2014-06-21 22:00:15
【问题描述】:
我刚刚用 Delphi XE6 做了一个应用程序,它接收基于this examplekinvey 的推送通知
当应用程序正在运行并且我发送推送时,PushEvent 处理程序会很好地接收它,但是当应用程序关闭并且我按下通知时,它只会打开我的应用程序。
我能否知道按下了哪个通知并从中获取参数?
提前致谢。
编辑:
我更接近一点,在我的 FormCreate 中询问 Extras:
procedure TForm1.FormCreate(Sender: TObject);
var
LIntent: JIntent;
LExtras: JBundle;
LExtrasArray: TJavaObjectArray<AndroidApi.JNI.JavaTypes.JObject>;
begin
LIntent := SharedActivity.getIntent;
try
if LIntent <> nil then
begin
LExtras := LIntent.getExtras;
if LExtras <> nil then
begin
//Now try to get the data
LExtrasArray := LExtras.KeySet.toArray;
for I := 0 to LExtrasArray.Length - 1 do
Memo1.Lines.Add(JStringToString(LExtrasArray.Items[I].toString));
end;
end;
finally
LIntent := nil;
end;
end;
使用此代码,我的备忘录中会出现“gcm”。 所以,当通知触发我的应用程序时,我会得到这个 Extra 可用。
现在的问题是我如何获得有关该额外内容的信息?
我试过LExtras.getString(StringToJString('message')),但这写的是''而不是推送消息
【问题讨论】:
标签: android delphi delphi-xe5 delphi-xe6