Skip to content
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

Android: Tapped notification when app in foreground doesn't show title, body or data #26

Open
ben-xD opened this issue Jul 29, 2023 · 3 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@ben-xD
Copy link
Owner

ben-xD commented Jul 29, 2023

I added to tool to send FCM push notifications in tools/android. Unfortunately, tapped notifications don't have much data here when the app is in the foreground.

It might appear, but it's not related to recent Android serialization fixes #21, since running commits before that also have this bug.

Tapped notification@2x

@ben-xD ben-xD added the bug Something isn't working label Jul 29, 2023
@ben-xD ben-xD changed the title Android: Tapped notification doesn't show title, body or data Android: Tapped notification when app in foreground doesn't show title, body or data Jul 29, 2023
@ben-xD
Copy link
Owner Author

ben-xD commented Jul 29, 2023

I don't really have a choice on this, since the intent delivered doesn't get any data on Android.

no data@2x

@ben-xD
Copy link
Owner Author

ben-xD commented Jul 29, 2023

Even sending a large paragraph in the notification (10 paragraphs of lorem ipsum), the bundle data size is still "80":
more proof@2x

@ben-xD
Copy link
Owner Author

ben-xD commented Jul 29, 2023

Ohhh, the intent action is SELECT_NOTIFICATION, that's from Flutter local notifications.

It's the one I create in the example app.

  void displayForegroundNotification(push.Notification notification) async {
    final androidOptions =
        AndroidNotificationDetails(debugChannel.id, debugChannel.name,
            channelDescription: debugChannel.description,
            importance: Importance.max,
            priority: Priority.high,
            ticker: "A manually-sent push notification.",
            styleInformation: const DefaultStyleInformation(
              false,
              false,
            ));
    const iosOptions = DarwinNotificationDetails(
        presentAlert: true, presentBadge: true, presentSound: true);
    final platformChannelSpecifics =
        NotificationDetails(android: androidOptions, iOS: iosOptions);
    await flutterLocalNotificationsPlugin.show(
        0, notification.title, notification.body, platformChannelSpecifics);
  }

So it's not a bug in push, but a limitation in the example.

@ben-xD ben-xD self-assigned this Jul 29, 2023
@ben-xD ben-xD added documentation Improvements or additions to documentation and removed bug Something isn't working labels Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant