Tapping on Android push notifications does not work

Hi, I’m having problems with the Android push notifications using Capacitor.

The notifications are received in both iOS and Android devices. Tapping the notifications on iOS device opens the app, but not in Android. In Android tapping a notification does not trigger anything.

I’ve searched for information and tried several solutions, but none of those worked.

Here it’s the message I send from the backend:

const message = {
token: “XXX”,
notification: {
title,
body: “XXX”,
},
data: {
click_action: “FLUTTER_NOTIFICATION_CLICK”,
title: “XXX”,
body: “XXX”,
notificationType: “XXX”,
messageType: “XXX”,
id: “XXX”,
},
apns: {
headers: {
“apns-priority”: “10”,
},
},
android: {
notification: {
defaultSound: true,
click_action: “FLUTTER_NOTIFICATION_CLICK”,
clickAction: “FLUTTER_NOTIFICATION_CLICK”,
},
},

My AndroidManifest.xml have the following:

<activity
android:exported=“true”
android:configChanges=“orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode”
android:name=“lbh.customer.portal.MainActivity”
android:label=“@string/title_activity_main”
android:theme=“@style/AppTheme.NoActionBarLaunch”
android:launchMode=“singleTask”>
<intent-filter>
<action android:name=“android.intent.action.MAIN” />
<category android:name=“android.intent.category.LAUNCHER” />
</intent-filter>

        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="@string/custom_url_scheme" />
        </intent-filter>
        <intent-filter>
            <action android:name="FLUTTER_NOTIFICATION_CLICK" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>

    </activity>

Any clue about what happens?

Your using capacitor with flutter? :thinking: Flutter has their own push notifications plugin.

Hi @Hills90210 , I’m using Capacitor with Ionic 6 - Angular 14

Your code you posted shows flutter. but anyway, have your set up Android properly? The docs show this: Push Notifications Capacitor Plugin API | Ionic Documentation

Oh sorry, I found that value reading other similar issues and I thought that the name should be exactly that one (I don’t know flutter).

I’m not familiarized with Android, but what I think is that the issue is in the click_action and the intent-filter. I think that they should match, but I’m not sure.

Thanks for sharing the link, but I think that I have the setup as being described there.

Regards.