firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.62k stars 3.95k forks source link

[firebase_messaging] push notification format 3 lines iOS and Android #1905

Closed ShrutiThakur01 closed 3 years ago

ShrutiThakur01 commented 4 years ago

Hello

I am working on firebase push notification for my project. I am receiving notification on all my devices.

My issue is

iOS devices showing notifications in below format.

Title : Subtitle : text/body:

My android devices showing notifications in below format.

Title : text/body:

below is the payload i am using for sending notification.

 var payload = {   "notification":{
          "title":"New Price Alert! "+ clientDataAfter.productname,
"subtitle":"Get before its gone",
          "body":"Old Price "+clientDataAfter.oldprice+" || New Price "+ clientDataAfter.newprice,
          "click_action":"FLUTTER_NOTIFICATION_CLICK",
        },
        "data" : {
          "id":ID,
          "name": Name,
          "newprice":newprice
        }, }

I want to show notifications in 3 line format on both iOS and android. How can i achieve this?

Thanks in advance.

iapicca commented 4 years ago

Hi @ShrutiThakur01 can you please provide your flutter doctor -v , your flutter run --verbose and your pubspec.yaml or if possible a reproducible minimal code sample. Thank you

ShrutiThakur01 commented 4 years ago

flutter doctor -v response

[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14.6 18G2022, locale en-IN)
    • Flutter version 1.12.13+hotfix.5 at /Users/COMPANY/Developer/flutter
    • Framework revision 27321ebbad (7 weeks ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
    • Android SDK at /Users/COMPANY/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.2.1, Build version 11B500
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 41.0.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[!] VS Code (version 1.41.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (1 available)
    • iPhone 8 • E7C3FC21-XXXX-4E1E-A631-XXXXXXXXXX • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-2 (simulator)

! Doctor found issues in 2 categories.
ShrutiThakur01 commented 4 years ago

pubspec.yaml

name: cmpic
description: A new Flutter application.

version: 1.0.0+1

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2
  flutter_custom_clippers: ^1.1.0
  flutter_auth_buttons: ^0.6.0
  liquid_swipe: ^1.2.0
  giffy_dialog: ^1.5.0
  animated_text_kit: ^1.3.1
  bottom_navy_bar: ^5.2.0
  percent_indicator: ^2.1.1
  firebase_core: ^0.4.0+9
  firebase_auth: ^0.14.0+5
  cloud_firestore: ^0.12.10
  uuid: ^2.0.0
  image_picker: ^0.6.1+10
  flutter_image_compress: ^0.6.3
  firebase_storage: ^3.0.6
  path_provider: ^1.4.0
  flutter_colorpicker: ^0.2.1
  rflutter_alert: ^1.0.3
  google_sign_in: ^4.0.7
  flushbar: ^1.9.1
  intl: ^0.16.0
  image_cropper: ^1.1.0
  gradient_app_bar: ^0.1.3
  font_awesome_flutter: ^8.5.0
  flutter_inner_drawer: ^0.5.1
  flutter_html: ^0.11.0
  flutter_facebook_login: ^2.0.1
  firebase_dynamic_links: ^0.5.0+8
  share: ^0.6.3+3
  keyboard_actions: ^3.1.2
  razorpay_flutter: 1.1.2
  fluttertoast: ^3.0.4
  cloud_functions: ^0.4.1+6
  cached_network_image: ^2.0.0-rc
  flutter_slidable: ^0.5.4
  flutter_speed_dial: ^1.2.5
  flutter_spinkit: ^4.1.1
  firebase_messaging:
  email_validator: 0.1.4
  url_launcher: ^5.4.1
  timeago: ^2.0.24
  flutter_picker: ^1.1.0
  terbilang: 1.0.5
  pdf: ^1.4.1

#  flutter_statusbarcolor: ^0.2.2
# cached_network_image: ^1.1.3
dev_dependencies:
  flutter_test:
    sdk: flutter

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700

  # To add assets to your application, add an assets section, like this:
  # assets:
  #  - images/a_dot_burr.jpeg
  #  - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages
ShrutiThakur01 commented 4 years ago

Hi, code i can't post as its a very big function taking device id from one table and sending this notification to all. TIA

ShrutiThakur01 commented 4 years ago

hi,

any update on this? TIA

ShrutiThakur01 commented 4 years ago

Hello All,

Any update on this? I want to show 3 line notification for my App on both iOS and Android.

TIA

ShrutiThakur01 commented 4 years ago

Hello All,

Any update on this?Or is there any other link i need to follow for this?

TIA

Salakar commented 3 years ago

Closing in favour of trying the latest messaging version which has since this issue was created been heavily reworked to improve it along with detailed documentation: https://firebase.flutter.dev/docs/messaging/overview

If you still have a problem please raise a new GitHub issue with up to date information and code snippets if possible. Thanks.