Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Click on notification not launching the app

When push notification is received while the app is not running and the user presses on notification, it just disappears and the log says:

2019-10-22 12:42:45.747 23260-23260/de.app.test.staging E/FirebaseMessaging: Notification pending intent canceled

Here is the SplashActivity that is supposed to be launched as a Launcher Activity:

    <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>

What can the issue be here?

like image 907
Sava Dimitrijević Avatar asked Jan 26 '23 16:01

Sava Dimitrijević


1 Answers

For anyone looking for an answer, the back-end was sending the "click_action" to notification, therefore there was no intent filter for that Activity.

For me the click_action is "OPEN_ACTIVITY_1" so I just added one more intent-filter to my SplashActivity like this:

<intent-filter>
        <action android:name="OPEN_ACTIVITY_1" />
        <category android:name="android.intent.category.DEFAULT" />
</intent-filter>
like image 192
Sava Dimitrijević Avatar answered Feb 08 '23 02:02

Sava Dimitrijević