Skip to content

[firebase_messaging]: app not launching when notification click on Android only issue #17165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
fullflash opened this issue Mar 4, 2025 · 4 comments
Closed
1 task done
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. platform: android Issues / PRs which are specifically for Android. plugin: messaging resolution: user This was a user issue, e.g. invalid configuration or code. type: bug Something isn't working

Comments

@fullflash
Copy link

fullflash commented Mar 4, 2025

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Messaging

Which platforms are affected?

Android

Description

Hi.
i can receive push notification but when clicking it does not opens the app
the problem only occurs on android .
i can see from logs that FirebaseMessaging.onBackgroundMessage trigger correctly
here is the failure logs from logcat .

3-04 11:37:38.092  2323  3729 I ActivityTaskManager: START u0 {act=open flg=0x14000000 pkg=com.app (has extras)} with LAUNCH_MULTIPLE from uid 10697 (realCallingUid=10037) result code=-91
03-04 11:37:38.092  2323  3729 D ActivityTaskManager: startActivity: reason=PendingIntentRecord, result=-91
<application
      android:label="Buzz"
      android:icon="@mipmap/ic_launcher"
  android:requestLegacyExternalStorage="true" 
  android:extractNativeLibs="true" 
  
   android:usesCleartextTraffic="true">
      <activity
              android:name="com.yalantis.ucrop.UCropActivity"
              android:screenOrientation="portrait"
              android:theme="@style/Ucrop.CropTheme"/>     
      <activity
          android:name=".MainActivity"
          android:exported="true"
          android:launchMode="singleTop"
          android:theme="@style/LaunchTheme"
          android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
          android:hardwareAccelerated="true"
          android:windowSoftInputMode="adjustResize">

          <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"/>
          <intent-filter>
              <action android:name="android.intent.action.MAIN"/>
              <category android:name="android.intent.category.LAUNCHER"/>
              <category android:name="android.intent.category.DEFAULT"/>
          </intent-filter>
      </activity>
      <meta-data
          android:name="flutterEmbedding"
          android:value="2"/>

Reproducing the issue

sending push using our backend receiving the notification for ios and android but for android does not opens the app

Firebase Core version

3.12.1

Flutter Version

3.29.0

Relevant Log Output

Flutter dependencies

Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.

app launches correctly when sending test push notification from firebase console

No response

@fullflash fullflash added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Mar 4, 2025
@fullflash
Copy link
Author

if some one can explain what is the reason of this error. if message is receiving on target device that means no problem with configuration also if app launches by firebase console test message but causing this error when sending using firebase admin sdk.

@SelaseKay SelaseKay added plugin: messaging platform: android Issues / PRs which are specifically for Android. labels Mar 4, 2025
@SelaseKay
Copy link
Contributor

Hi @fullflash, I'm unable to reproduce this issue. Have you tested with other Android devices?

@SelaseKay SelaseKay added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Mar 4, 2025
@rickyoleary
Copy link

rickyoleary commented Mar 4, 2025

I've having the same issue, from what I can see the background handler works the very first time (on a fresh install). Using Postman I notice the message ID is always the same, so it seems Android/Flutter isn't clearing the message ID or fully receiving it, so as a result when tapping the icon nothing happens (well it launches the app but doesn't fire the on tap logic).

The pay load I'm using is from their docs:

{
"message": {
"token": "e1wAoS4JTh64NNKPG-Rsw3:APA91bEkMLHpt9I_zUSBEnWMyYeOQPE8y8svNDGxReehZyK_Jjk9aUulfuTJymqLy7K6QUJqje2L7ddv0xms6ijoGGDEfcX1IVwdfi0xS9Vm_qCd8aRaSxg",
"notification":{
"title":"Portugal vs. Denmark",
"body":"great match!"
},
"data" : {
"Nick" : "Mario",
"Room" : "PortugalVSDenmark"
}}
}

and the same message ID is always returned. I have tried the specific Android properties too and the click_action etc, to no avail. The FCM console works every time.

@fullflash
Copy link
Author

fullflash commented Mar 4, 2025

the solution was to removing click_action: 'FLUTTER_NOTIFICATION_CLICK' from json payload that you are sending from backend.

 {
        notification: {
            title: pushTitle,
            body: pushBodyMsg,
            image:pushImgUrl
            // click_action: 'FLUTTER_NOTIFICATION_CLICK' //remove this line
        },
        data:pushData,
        tokens:deviceTokensArray
    };

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. platform: android Issues / PRs which are specifically for Android. plugin: messaging resolution: user This was a user issue, e.g. invalid configuration or code. type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants