question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android notification action reply input not returning reply_text

See original GitHub issue

Bug

When pushing a notification on Android with a reply action, I am not getting the reply_text back. The notification pops up on the device with the reply action, I can enter a message and click send, but the notification that the application receives, has no “reply_text” field with the message that was typed in.

On iOS this working fine, I see the reply_text field and can handle it accordingly. Any idea why this could be broken?

Environment info

react-native info output:

System:
    OS: macOS 11.5.2
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 681.73 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.13 - /usr/local/bin/npm
    Watchman: 2021.06.07.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
    Android SDK:
      API Levels: 29, 30
      Build Tools: 29.0.2, 30.0.3
      System Images: android-29 | Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.2 AI-202.7660.26.42.7351085
    Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_292 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: Not Found
    react-native: * => 0.64.2 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Library version: “react-native-push-notification”: “^8.1.0”,

Steps To Reproduce

  1. Send a notification
PushNotification.localNotification({ title, message, userInfo, actions: ["ReplyInput"], reply_palceholderText: "placeholder", reply_button_text: "Reply" })
  1. Notification received on device
  2. Press the reply button and submit a message
  3. Notification handler triggers on device and returns notification without a “reply_text” field, but has everything else

Describe what you expected to happen:

  1. Expected to get reply_text in the notification object with the message I typed in (works in iOS)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
TongManhCongcommented, Sep 23, 2021

reason in file RNPushNotificationAcions can’t get text in remoteInput => can’t callback to js.

Fix: In filepath: “node_modules/react-native-push-notification/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java”

edit Intent actionIntent = new Intent(context, RNPushNotificationActions.class); to Intent actionIntent = new Intent(context, com.dieam.reactnativepushnotification.modules.RNPushNotificationActions.class);

and

edit int flags = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE : PendingIntent.FLAG_UPDATE_CURRENT; to int flags = PendingIntent.FLAG_UPDATE_CURRENT;

1reaction
Dallas62commented, Nov 5, 2021

I wondering if someone can test this version:

yarn add zo0r/react-native-push-notification#dev

The CHANGELOG is available here: https://github.com/zo0r/react-native-push-notification/blob/dev/CHANGELOG.md#unreleased

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to send reply from expandable notification in android?
The second best thing you can do is have them click reply and a dialog can open with only the required fields (and...
Read more >
An Android Direct Reply Notification Tutorial - Techotopia
This allows the user to reply to a message in the notification without the need to launch an activity within the app. This...
Read more >
Notification.Builder | Android Developers
Actions will not be displayed when the notification is collapsed, however, ... Note: The reply text will only be shown on notifications that...
Read more >
How to respond to any* messaging notification on Android
If not: it's an app that syncs all your notification across devices, ... the called app will look for the reply text in...
Read more >
Enhanced Notifications in Android N with Direct Reply
requestCode · 0 · public ; replyText · "Reply to message..." · //create remote input that will read text ; action · new...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found