【问题标题】:How to handle Firebase FCM click_action in Delphi firemonkey android?如何在 Delphi firemonkey android 中处理 Firebase FCM click_action?
【发布时间】:2019-12-20 17:06:48
【问题描述】:

我能够使用 Delphi 10.3.2 重现相同的 android 应用程序,请按照以下步骤操作 https://community.idera.com/developer-tools/b/blog/posts/firebase-android-push-notification-support-with-rad-studio-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 吗?

【问题讨论】:

  • 你有解决这个问题的方法吗? Tnx

标签: delphi click firebase-cloud-messaging action rad-studio


【解决方案1】:

如何处理的例子:

constructor TForm1.Create(AOwner: TComponent);
var
  LPushData: TPushData;
begin
  inherited;
  LPushData := PushEvents1.StartupNotification;
  if LPushData <> nil then
    PushEvents1PushReceived(PushEvents1, LPushData);
end;

【讨论】:

  • 你有更详细的例子吗? PushEvents1 是否独立工作?
  • 如何使用TPushEvents的详细示例在实际问题的第一个链接中:stackoverflow.com/q/57489647/3164070
猜你喜欢
  • 2022-08-15
  • 2016-09-21
  • 1970-01-01
  • 2017-08-15
  • 1970-01-01
  • 1970-01-01
  • 2020-06-26
  • 1970-01-01
  • 2021-02-09
相关资源
最近更新 更多