delphi - 如何在 Delphi firemonkey android 中处理 Firebase FCM click_action?
问题描述
我可以使用 Delphi 10.3.2 重现相同的 android 应用程序,按照 https://community.idera.com/developer-tools/b/blog/posts/firebase-android-push-notification-support-with-中的步骤操作辐射工作室 10-3-1
接收firebase推送通知,但是,当用户单击通知时,我没有发现处理FCM click_action的线索。
我尝试向 androidmanifest.xml 添加一个额外的意图过滤器操作 android:name="CUSTOM_ACTION"
<activity android:name="com.embarcadero.firemonkey.FMXNativeActivity"
android:label="ione"
android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
android:launchMode="singleTask">
<!-- Tell NativeActivity the name of our .so -->
<meta-data android:name="android.app.lib_name"
android:value="ione" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="CUSTOM_ACTION" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
并使用 MainActivity.registerIntentAction(StringtoJString('CUSTOM_ACTION'));
注册意图动作和测试。
如果我在 FCM 通知中包含 click_action,当用户单击通知时,什么也不会发生。如果我删除 click_action,当用户点击通知时,应用程序将被打开。
任何人都知道我们应该如何在 Delphi 中配置来处理 FCM click_action ?
解决方案
如何处理它的示例:
constructor TForm1.Create(AOwner: TComponent);
var
LPushData: TPushData;
begin
inherited;
LPushData := PushEvents1.StartupNotification;
if LPushData <> nil then
PushEvents1PushReceived(PushEvents1, LPushData);
end;
推荐阅读
- python - python 食谱中的掷骰子
- apache - 启用 https 到 Xampp localhost
- android - 使用 Ionic 框架在 HTML5 音频播放器上播放来自 Android 设备的本地音频文件
- c# - 在 DataGridView 中显示性别 0,1
- html - 使 CSS 网格单元格图像项使用所有可用空间
- node.js - 我的聊天机器人应用程序未在 SSL 认证服务器上运行
- java - CoreNLP 的共指解析
- java - Android Studio 无法正确显示 xml 文件
- javascript - 如何为锚标签禁用 routerLink
- .net - 更新后无法查询 Couchbase 文档