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

cancelNotification in AndroidNotificationAction it's not working #2527

Open
mbenci opened this issue Feb 3, 2025 · 2 comments
Open

cancelNotification in AndroidNotificationAction it's not working #2527

mbenci opened this issue Feb 3, 2025 · 2 comments

Comments

@mbenci
Copy link

mbenci commented Feb 3, 2025

Describe the bug
I modified the example file in particular in the text response action "_showNotificationWithTextAction" by adding "cancelNotification: false" in order that the notification remains even following the response.
The effect is that upon clicking on sending the test message a perpetual loader.

flutter_local_notification_text_input_bug.mp4

To Reproduce
Change the method _showNotificationWithTextAction in the example code like this

Future<void> _showNotificationWithTextAction() async {
    const AndroidNotificationDetails androidNotificationDetails =
        AndroidNotificationDetails(
      'your channel id',
      'your channel name',
      channelDescription: 'your channel description',
      importance: Importance.max,
      priority: Priority.high,
      ticker: 'ticker',
      actions: <AndroidNotificationAction>[
        AndroidNotificationAction(
          'text_id_1',
          'Enter Text',
          icon: DrawableResourceAndroidBitmap('food'),
          cancelNotification: false,
          inputs: <AndroidNotificationActionInput>[
            AndroidNotificationActionInput(
              label: 'Enter a message',
            ),
          ],
        ),
      ],
    );

Launch the example app --> click on the "Show notification with text action" button --> respond to the notification and send

Expected behavior
The expected behavior is that the message is sent and the notification remains present

@jayantur13
Copy link

jayantur13 commented Feb 4, 2025

In manifest, you may have forgot to add this -

<receiver 
       android:name="com.dexterous.flutterlocalnotifications.ActionBroadcastReceiver" 
       android:exported="false"/>

From #2152

@mbenci
Copy link
Author

mbenci commented Feb 4, 2025

My manifest is correct, but the manifest in the example is also correct and in fact the behavior is the same.
(https://github.com/MaikuB/flutter_local_notifications/blob/master/flutter_local_notifications/example/android/app/src/main/AndroidManifest.xml)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants