单击通知未启动应用程序

Sav*_*vić 4 android push-notification firebase firebase-cloud-messaging

当应用程序未运行时收到推送通知并且用户按下通知时,它会消失并且日志显示:

2019-10-22 12:42:45.747 23260-23260/de.app.test.staging E/FirebaseMessaging: Notification pending intent canceled
Run Code Online (Sandbox Code Playgroud)

这是应该作为启动器活动启动的 SplashActivity:

    <activity
        android:name="de.app.test.login.SplashActivity"
        android:screenOrientation="portrait"
        android:exported="true"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
Run Code Online (Sandbox Code Playgroud)

这里有什么问题?

Sav*_*vić 7

对于任何寻找答案的人,后端正在向通知发送“click_action”,因此该活动没有意图过滤器。

对我来说,click_action 是“OPEN_ACTIVITY_1”,所以我只是在我的 SplashActivity 中添加了一个意图过滤器,如下所示:

<intent-filter>
        <action android:name="OPEN_ACTIVITY_1" />
        <category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)